forked from qt-creator/qt-creator
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:
@@ -70,10 +70,10 @@ bool AndroidAvdManager::avdManagerCommand(const AndroidConfig &config, const QSt
|
||||
Environment env = AndroidConfigurations::toolsEnvironment(config);
|
||||
proc.setEnvironment(env);
|
||||
qCDebug(avdManagerLog) << "Running AVD Manager command:" << cmd.toUserOutput();
|
||||
SynchronousProcessResponse response = proc.runBlocking(cmd);
|
||||
if (response.result == Utils::SynchronousProcessResponse::Finished) {
|
||||
proc.runBlocking(cmd);
|
||||
if (proc.result() == Utils::QtcProcess::Finished) {
|
||||
if (output)
|
||||
*output = response.allOutput();
|
||||
*output = proc.allOutput();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -199,10 +199,10 @@ bool AndroidAvdManager::removeAvd(const QString &name) const
|
||||
{
|
||||
const CommandLine command(m_config.avdManagerToolPath(), {"delete", "avd", "-n", name});
|
||||
qCDebug(avdManagerLog) << "Running command (removeAvd):" << command.toUserOutput();
|
||||
Utils::SynchronousProcess proc;
|
||||
SynchronousProcess proc;
|
||||
proc.setTimeoutS(5);
|
||||
const Utils::SynchronousProcessResponse response = proc.runBlocking(command);
|
||||
return response.result == Utils::SynchronousProcessResponse::Finished && response.exitCode == 0;
|
||||
proc.runBlocking(command);
|
||||
return proc.result() == QtcProcess::Finished && proc.exitCode() == 0;
|
||||
}
|
||||
|
||||
static void avdConfigEditManufacturerTag(const QString &avdPathStr, bool recoverMode = false)
|
||||
@@ -350,10 +350,10 @@ bool AndroidAvdManager::isAvdBooted(const QString &device) const
|
||||
qCDebug(avdManagerLog) << "Running command (isAvdBooted):" << command.toUserOutput();
|
||||
SynchronousProcess adbProc;
|
||||
adbProc.setTimeoutS(10);
|
||||
const SynchronousProcessResponse response = adbProc.runBlocking(command);
|
||||
if (response.result != Utils::SynchronousProcessResponse::Finished)
|
||||
adbProc.runBlocking(command);
|
||||
if (adbProc.result() != QtcProcess::Finished)
|
||||
return false;
|
||||
QString value = response.allOutput().trimmed();
|
||||
QString value = adbProc.allOutput().trimmed();
|
||||
return value == "stopped";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user