Utils: Join SynchronousProcess::run and runBlocking implementations

Make functionality dependent on an (intentionally ugly)
setProcessUserEventWhileRunning call.

Also, back-paddle a bit on API combination of QtcProcess and
SynchronousPrceoss for now and prevent the QtcProcess-and-
runBlocking and SynchronousProcess-and-start combinations.

Goal is still to have all in QtcProcess in the end, but this
may take a while.

Change-Id: Ic146ec5db0ab8dc9613e5b2af5f4dc90bc7465ca
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-05-20 13:14:15 +02:00
parent c36b50f401
commit 770d87709e
12 changed files with 102 additions and 106 deletions

View File

@@ -539,7 +539,8 @@ bool AndroidManager::checkKeystorePassword(const QString &keystorePath, const QS
SynchronousProcess proc;
proc.setTimeoutS(10);
proc.setCommand(cmd);
proc.run();
proc.setProcessUserEventWhileRunning();
proc.runBlocking();
return proc.result() == QtcProcess::Finished && proc.exitCode() == 0;
}
@@ -556,7 +557,8 @@ bool AndroidManager::checkCertificatePassword(const QString &keystorePath, const
SynchronousProcess proc;
proc.setTimeoutS(10);
proc.setCommand({AndroidConfigurations::currentConfig().keytoolPath(), arguments});
proc.run();
proc.setProcessUserEventWhileRunning();
proc.runBlocking();
return proc.result() == QtcProcess::Finished && proc.exitCode() == 0;
}
@@ -570,7 +572,8 @@ bool AndroidManager::checkCertificateExists(const QString &keystorePath,
SynchronousProcess proc;
proc.setTimeoutS(10);
proc.setCommand({AndroidConfigurations::currentConfig().keytoolPath(), arguments});
proc.run();
proc.setProcessUserEventWhileRunning();
proc.runBlocking();
return proc.result() == QtcProcess::Finished && proc.exitCode() == 0;
}
@@ -727,7 +730,8 @@ SdkToolResult AndroidManager::runCommand(const CommandLine &command,
cmdProc.setWriteData(writeData);
qCDebug(androidManagerLog) << "Running command (sync):" << command.toUserOutput();
cmdProc.setCommand(command);
cmdProc.run();
cmdProc.setProcessUserEventWhileRunning();
cmdProc.runBlocking();
cmdResult.m_stdOut = cmdProc.stdOut().trimmed();
cmdResult.m_stdErr = cmdProc.stdErr().trimmed();
cmdResult.m_success = cmdProc.result() == QtcProcess::Finished;