CommandLine: Reuse new c'tor

Change-Id: Id154881b4f5d8c488e5c1f5e0f843d36bf838759
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2024-05-16 14:07:59 +02:00
parent d857af4cec
commit 982ad24243
39 changed files with 104 additions and 165 deletions

View File

@@ -237,17 +237,17 @@ GroupItem DeviceCtlRunner::launchTask(const QString &bundleIdentifier)
return SetupResult::StopWithError;
}
process.setCommand({FilePath::fromString("/usr/bin/xcrun"),
QStringList{"devicectl",
"device",
"process",
"launch",
"--device",
m_device->uniqueInternalDeviceId(),
"--quiet",
"--json-output",
"-",
bundleIdentifier}
+ m_arguments});
{"devicectl",
"device",
"process",
"launch",
"--device",
m_device->uniqueInternalDeviceId(),
"--quiet",
"--json-output",
"-",
bundleIdentifier,
m_arguments}});
return SetupResult::Continue;
};
const auto onDone = [this](const Process &process, DoneWith result) {

View File

@@ -86,20 +86,18 @@ static expected_str<void> runCommand(
}
static expected_str<void> runSimCtlCommand(
QStringList args,
const QStringList &args,
QString *output,
QString *allOutput = nullptr,
std::function<bool()> shouldStop = [] { return false; })
{
args.prepend("simctl");
// Cache xcrun's path, as this function will be called often.
static FilePath xcrun = FilePath::fromString("xcrun").searchInPath();
if (xcrun.isEmpty())
return make_unexpected(Tr::tr("Cannot find xcrun."));
else if (!xcrun.isExecutableFile())
return make_unexpected(Tr::tr("xcrun is not executable."));
return runCommand({xcrun, args}, output, allOutput, shouldStop);
return runCommand({xcrun, {"simctl", args}}, output, allOutput, shouldStop);
}
static expected_str<void> launchSimulator(const QString &simUdid, std::function<bool()> shouldStop)