Utils: Make process results accessible through QtcProcess object

The result is fully stored in the object anyway. Using the extra
SynchronousProcessResponse structure only causes copies of
the data and complicates access on the user side in
a lot of cases.

The result bits are now also accessible individually.

There's obvious room for follow-up changes on the topic, e.g.
ShellCommand::runCommand's parameter list could shrink to
just a SynchronousProcess parameter.

Change-Id: I45aa7eb23832340be06905929280c012e1217263
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-05-12 14:25:50 +02:00
parent f23b27ded6
commit 55f768e1b0
54 changed files with 747 additions and 706 deletions

View File

@@ -236,10 +236,10 @@ static QByteArray decodeProvisioningProfile(const QString &path)
p.setTimeoutS(3);
// path is assumed to be valid file path to .mobileprovision
const QStringList args = {"smime", "-inform", "der", "-verify", "-in", path};
Utils::SynchronousProcessResponse res = p.runBlocking({"openssl", args});
if (res.result != Utils::SynchronousProcessResponse::Finished)
p.runBlocking({"openssl", args});
if (p.result() != Utils::QtcProcess::Finished)
qCDebug(iosCommonLog) << "Reading signed provisioning file failed" << path;
return res.stdOut().toLatin1();
return p.stdOut().toLatin1();
}
void IosConfigurations::updateAutomaticKitList()

View File

@@ -68,12 +68,12 @@ void XcodeProbe::detectDeveloperPaths()
Utils::SynchronousProcess selectedXcode;
selectedXcode.setTimeoutS(5);
const CommandLine xcodeSelect{"/usr/bin/xcode-select", {"--print-path"}};
Utils::SynchronousProcessResponse response = selectedXcode.run(xcodeSelect);
if (response.result != Utils::SynchronousProcessResponse::Finished)
selectedXcode.run(xcodeSelect);
if (selectedXcode.result() != QtcProcess::Finished)
qCWarning(probeLog)
<< QString::fromLatin1("Could not detect selected Xcode using xcode-select");
else
addDeveloperPath(response.stdOut().trimmed());
addDeveloperPath(selectedXcode.stdOut().trimmed());
addDeveloperPath(defaultDeveloperPath);
}

View File

@@ -83,12 +83,12 @@ static bool runCommand(const CommandLine &command, QString *stdOutput, QString *
{
SynchronousProcess p;
p.setTimeoutS(-1);
SynchronousProcessResponse resp = p.runBlocking(command);
p.runBlocking(command);
if (stdOutput)
*stdOutput = resp.stdOut();
*stdOutput = p.stdOut();
if (allOutput)
*allOutput = resp.allOutput();
return resp.result == SynchronousProcessResponse::Finished;
*allOutput = p.allOutput();
return p.result() == QtcProcess::Finished;
}
static bool runSimCtlCommand(QStringList args, QString *output, QString *allOutput = nullptr)