Utils: Drop OsType parameter from CommandLine functions

The type is implicitly given by the command's executble FilePath.

Also, rename the rarely used addArgs(const CommandLine &) overload
to addCommandLineAsArgs() and make it strip scheme and host from
the wrapped executable as there are no uses expected where keeping
them would be the right thing.

Change-Id: Id0b76778e7e01ac16e477f36bf30bb28d96bb177
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-08-12 13:04:22 +02:00
parent d735d3238f
commit 20a63d6c7e
7 changed files with 20 additions and 22 deletions

View File

@@ -1430,7 +1430,6 @@ void DockerDevice::runProcess(QtcProcess &process) const
}
const FilePath workingDir = process.workingDirectory();
const CommandLine origCmd = process.commandLine();
const Environment env = process.environment();
CommandLine cmd{"docker", {"exec"}};
@@ -1450,8 +1449,7 @@ void DockerDevice::runProcess(QtcProcess &process) const
// }
}
cmd.addArg(d->m_container);
cmd.addArg(origCmd.executable().path()); // Cut off the docker://.../ bits.
cmd.addArgs(origCmd.splitArguments(osType()));
cmd.addCommandLineAsArgs(process.commandLine());
LOG("Run" << cmd.toUserOutput() << " in " << workingDir.toUserOutput());
@@ -1491,7 +1489,7 @@ bool DockerDevicePrivate::runInContainer(const CommandLine &cmd) const
if (!DockerPlugin::isDaemonRunning().value_or(false))
return false;
CommandLine dcmd{"docker", {"exec", m_container}};
dcmd.addArgs(cmd);
dcmd.addCommandLineAsArgs(cmd);
QtcProcess proc;
proc.setCommand(dcmd);