All: Replace most SynchronousProcess by QtcProcess

Change-Id: I0bf22fef2cd4a7297ef5a1e9aa9c3e2b9348ba42
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-06-22 04:33:47 +02:00
parent 8ac67dd1b7
commit 430e81facd
55 changed files with 157 additions and 158 deletions

View File

@@ -419,7 +419,7 @@ QString PluginManager::systemInformation()
QString result; QString result;
CommandLine qtDiag(HostOsInfo::withExecutableSuffix( CommandLine qtDiag(HostOsInfo::withExecutableSuffix(
QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qtdiag")); QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qtdiag"));
SynchronousProcess qtDiagProc; QtcProcess qtDiagProc;
qtDiagProc.setCommand(qtDiag); qtDiagProc.setCommand(qtDiag);
qtDiagProc.runBlocking(); qtDiagProc.runBlocking();
if (qtDiagProc.result() == QtcProcess::FinishedWithSuccess) if (qtDiagProc.result() == QtcProcess::FinishedWithSuccess)

View File

@@ -44,7 +44,7 @@ bool BuildableHelperLibrary::isQtChooser(const QFileInfo &info)
QString BuildableHelperLibrary::qtChooserToQmakePath(const QString &path) QString BuildableHelperLibrary::qtChooserToQmakePath(const QString &path)
{ {
const QString toolDir = QLatin1String("QTTOOLDIR=\""); const QString toolDir = QLatin1String("QTTOOLDIR=\"");
SynchronousProcess proc; QtcProcess proc;
proc.setTimeoutS(1); proc.setTimeoutS(1);
proc.setCommand({path, {"-print-env"}}); proc.setCommand({path, {"-print-env"}});
proc.runBlocking(); proc.runBlocking();
@@ -129,7 +129,7 @@ QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath)
if (qmakePath.isEmpty()) if (qmakePath.isEmpty())
return QString(); return QString();
SynchronousProcess qmake; QtcProcess qmake;
qmake.setTimeoutS(5); qmake.setTimeoutS(5);
qmake.setCommand({qmakePath, {"--version"}}); qmake.setCommand({qmakePath, {"--version"}});
qmake.runBlocking(); qmake.runBlocking();

View File

@@ -149,7 +149,7 @@ QString BinaryVersionToolTipEventFilter::toolVersion(const CommandLine &cmd)
{ {
if (cmd.executable().isEmpty()) if (cmd.executable().isEmpty())
return QString(); return QString();
SynchronousProcess proc; QtcProcess proc;
proc.setTimeoutS(1); proc.setTimeoutS(1);
proc.setCommand(cmd); proc.setCommand(cmd);
proc.runBlocking(); proc.runBlocking();

View File

@@ -183,7 +183,6 @@ public:
QProcess::OpenMode m_openMode = QProcess::ReadWrite; QProcess::OpenMode m_openMode = QProcess::ReadWrite;
// SynchronousProcess left overs:
void slotTimeout(); void slotTimeout();
void slotFinished(int exitCode, QProcess::ExitStatus e); void slotFinished(int exitCode, QProcess::ExitStatus e);
void slotError(QProcess::ProcessError); void slotError(QProcess::ProcessError);
@@ -492,7 +491,7 @@ static bool askToKill(const QString &command)
} }
// Helper for running a process synchronously in the foreground with timeout // Helper for running a process synchronously in the foreground with timeout
// detection similar SynchronousProcess' handling (taking effect after no more output // detection (taking effect after no more output
// occurs on stderr/stdout as opposed to waitForFinished()). Returns false if a timeout // occurs on stderr/stdout as opposed to waitForFinished()). Returns false if a timeout
// occurs. Checking of the process' exit state/code still has to be done. // occurs. Checking of the process' exit state/code still has to be done.
@@ -984,7 +983,7 @@ static bool isGuiThread()
} }
#endif #endif
void SynchronousProcess::runBlocking() void QtcProcess::runBlocking()
{ {
// FIXME: Implement properly // FIXME: Implement properly
if (d->m_commandLine.executable().needsDevice()) { if (d->m_commandLine.executable().needsDevice()) {

View File

@@ -272,7 +272,7 @@ void ShellCommand::run(QFutureInterface<void> &future)
d->m_lastExecSuccess = true; d->m_lastExecSuccess = true;
for (int j = 0; j < count; j++) { for (int j = 0; j < count; j++) {
const Internal::ShellCommandPrivate::Job &job = d->m_jobs.at(j); const Internal::ShellCommandPrivate::Job &job = d->m_jobs.at(j);
SynchronousProcess proc; QtcProcess proc;
proc.setExitCodeInterpreter(job.exitCodeInterpreter); proc.setExitCodeInterpreter(job.exitCodeInterpreter);
proc.setTimeoutS(job.timeoutS); proc.setTimeoutS(job.timeoutS);
runCommand(proc, job.command, job.workingDirectory); runCommand(proc, job.command, job.workingDirectory);
@@ -306,7 +306,7 @@ void ShellCommand::run(QFutureInterface<void> &future)
this->deleteLater(); this->deleteLater();
} }
void ShellCommand::runCommand(SynchronousProcess &proc, void ShellCommand::runCommand(QtcProcess &proc,
const CommandLine &command, const CommandLine &command,
const QString &workingDirectory) const QString &workingDirectory)
{ {
@@ -340,7 +340,7 @@ void ShellCommand::runCommand(SynchronousProcess &proc,
} }
} }
void ShellCommand::runFullySynchronous(SynchronousProcess &process, void ShellCommand::runFullySynchronous(QtcProcess &process,
const QString &workingDirectory) const QString &workingDirectory)
{ {
// Set up process // Set up process
@@ -372,10 +372,10 @@ void ShellCommand::runFullySynchronous(SynchronousProcess &process,
} }
} }
void ShellCommand::runSynchronous(SynchronousProcess &process, void ShellCommand::runSynchronous(QtcProcess &process,
const QString &workingDirectory) const QString &workingDirectory)
{ {
connect(this, &ShellCommand::terminate, &process, &SynchronousProcess::stopProcess); connect(this, &ShellCommand::terminate, &process, &QtcProcess::stopProcess);
process.setEnvironment(processEnvironment()); process.setEnvironment(processEnvironment());
if (d->m_codec) if (d->m_codec)
process.setCodec(d->m_codec); process.setCodec(d->m_codec);

View File

@@ -123,7 +123,7 @@ public:
// This is called once per job in a thread. // This is called once per job in a thread.
// When called from the UI thread it will execute fully synchronously, so no signals will // When called from the UI thread it will execute fully synchronously, so no signals will
// be triggered! // be triggered!
virtual void runCommand(Utils::SynchronousProcess &process, virtual void runCommand(Utils::QtcProcess &process,
const CommandLine &command, const CommandLine &command,
const QString &workingDirectory = QString()); const QString &workingDirectory = QString());
@@ -153,10 +153,10 @@ private:
void run(QFutureInterface<void> &future); void run(QFutureInterface<void> &future);
// Run without a event loop in fully blocking mode. No signals will be delivered. // Run without a event loop in fully blocking mode. No signals will be delivered.
void runFullySynchronous(SynchronousProcess &proc, void runFullySynchronous(QtcProcess &proc,
const QString &workingDirectory); const QString &workingDirectory);
// Run with an event loop. Signals will be delivered. // Run with an event loop. Signals will be delivered.
void runSynchronous(SynchronousProcess &proc, void runSynchronous(QtcProcess &proc,
const QString &workingDirectory); const QString &workingDirectory);
class Internal::ShellCommandPrivate *const d; class Internal::ShellCommandPrivate *const d;

View File

@@ -66,7 +66,7 @@ const int avdCreateTimeoutMs = 30000;
bool AndroidAvdManager::avdManagerCommand(const AndroidConfig &config, const QStringList &args, QString *output) bool AndroidAvdManager::avdManagerCommand(const AndroidConfig &config, const QStringList &args, QString *output)
{ {
CommandLine cmd(config.avdManagerToolPath(), args); CommandLine cmd(config.avdManagerToolPath(), args);
Utils::SynchronousProcess proc; Utils::QtcProcess proc;
Environment env = AndroidConfigurations::toolsEnvironment(config); Environment env = AndroidConfigurations::toolsEnvironment(config);
proc.setEnvironment(env); proc.setEnvironment(env);
qCDebug(avdManagerLog) << "Running AVD Manager command:" << cmd.toUserOutput(); qCDebug(avdManagerLog) << "Running AVD Manager command:" << cmd.toUserOutput();
@@ -200,7 +200,7 @@ bool AndroidAvdManager::removeAvd(const QString &name) const
{ {
const CommandLine command(m_config.avdManagerToolPath(), {"delete", "avd", "-n", name}); const CommandLine command(m_config.avdManagerToolPath(), {"delete", "avd", "-n", name});
qCDebug(avdManagerLog) << "Running command (removeAvd):" << command.toUserOutput(); qCDebug(avdManagerLog) << "Running command (removeAvd):" << command.toUserOutput();
SynchronousProcess proc; QtcProcess proc;
proc.setTimeoutS(5); proc.setTimeoutS(5);
proc.setCommand(command); proc.setCommand(command);
proc.runBlocking(); proc.runBlocking();
@@ -350,7 +350,7 @@ bool AndroidAvdManager::isAvdBooted(const QString &device) const
const CommandLine command({m_config.adbToolPath(), arguments}); const CommandLine command({m_config.adbToolPath(), arguments});
qCDebug(avdManagerLog) << "Running command (isAvdBooted):" << command.toUserOutput(); qCDebug(avdManagerLog) << "Running command (isAvdBooted):" << command.toUserOutput();
SynchronousProcess adbProc; QtcProcess adbProc;
adbProc.setTimeoutS(10); adbProc.setTimeoutS(10);
adbProc.setCommand(command); adbProc.setCommand(command);
adbProc.runBlocking(); adbProc.runBlocking();

View File

@@ -1006,7 +1006,7 @@ QAbstractItemModel *AndroidBuildApkStep::keystoreCertificates()
const QStringList params = {"-list", "-v", "-keystore", m_keystorePath.toUserOutput(), const QStringList params = {"-list", "-v", "-keystore", m_keystorePath.toUserOutput(),
"-storepass", m_keystorePasswd, "-J-Duser.language=en"}; "-storepass", m_keystorePasswd, "-J-Duser.language=en"};
SynchronousProcess keytoolProc; QtcProcess keytoolProc;
keytoolProc.setTimeoutS(30); keytoolProc.setTimeoutS(30);
keytoolProc.setCommand({AndroidConfigurations::currentConfig().keytoolPath(), params}); keytoolProc.setCommand({AndroidConfigurations::currentConfig().keytoolPath(), params});
keytoolProc.setProcessUserEventWhileRunning(); keytoolProc.setProcessUserEventWhileRunning();

View File

@@ -156,7 +156,7 @@ namespace {
if (executable.isEmpty() || shell.isEmpty()) if (executable.isEmpty() || shell.isEmpty())
return true; // we can't detect, but creator is 32bit so assume 32bit return true; // we can't detect, but creator is 32bit so assume 32bit
SynchronousProcess proc; QtcProcess proc;
proc.setProcessChannelMode(QProcess::MergedChannels); proc.setProcessChannelMode(QProcess::MergedChannels);
proc.setTimeoutS(30); proc.setTimeoutS(30);
proc.setCommand({executable, {shell}}); proc.setCommand({executable, {shell}});
@@ -560,7 +560,7 @@ QVector<AndroidDeviceInfo> AndroidConfig::connectedDevices(QString *error) const
QVector<AndroidDeviceInfo> AndroidConfig::connectedDevices(const FilePath &adbToolPath, QString *error) QVector<AndroidDeviceInfo> AndroidConfig::connectedDevices(const FilePath &adbToolPath, QString *error)
{ {
QVector<AndroidDeviceInfo> devices; QVector<AndroidDeviceInfo> devices;
SynchronousProcess adbProc; QtcProcess adbProc;
adbProc.setTimeoutS(30); adbProc.setTimeoutS(30);
CommandLine cmd{adbToolPath, {"devices"}}; CommandLine cmd{adbToolPath, {"devices"}};
adbProc.setCommand(cmd); adbProc.setCommand(cmd);
@@ -630,7 +630,7 @@ QString AndroidConfig::getDeviceProperty(const FilePath &adbToolPath, const QStr
CommandLine cmd(adbToolPath, AndroidDeviceInfo::adbSelector(device)); CommandLine cmd(adbToolPath, AndroidDeviceInfo::adbSelector(device));
cmd.addArgs({"shell", "getprop", property}); cmd.addArgs({"shell", "getprop", property});
SynchronousProcess adbProc; QtcProcess adbProc;
adbProc.setTimeoutS(10); adbProc.setTimeoutS(10);
adbProc.setCommand(cmd); adbProc.setCommand(cmd);
adbProc.runBlocking(); adbProc.runBlocking();
@@ -728,7 +728,7 @@ QStringList AndroidConfig::getAbis(const FilePath &adbToolPath, const QString &d
// First try via ro.product.cpu.abilist // First try via ro.product.cpu.abilist
QStringList arguments = AndroidDeviceInfo::adbSelector(device); QStringList arguments = AndroidDeviceInfo::adbSelector(device);
arguments << "shell" << "getprop" << "ro.product.cpu.abilist"; arguments << "shell" << "getprop" << "ro.product.cpu.abilist";
SynchronousProcess adbProc; QtcProcess adbProc;
adbProc.setTimeoutS(10); adbProc.setTimeoutS(10);
adbProc.setCommand({adbToolPath, arguments}); adbProc.setCommand({adbToolPath, arguments});
adbProc.runBlocking(); adbProc.runBlocking();
@@ -751,7 +751,7 @@ QStringList AndroidConfig::getAbis(const FilePath &adbToolPath, const QString &d
else else
arguments << QString::fromLatin1("ro.product.cpu.abi%1").arg(i); arguments << QString::fromLatin1("ro.product.cpu.abi%1").arg(i);
SynchronousProcess abiProc; QtcProcess abiProc;
abiProc.setTimeoutS(10); abiProc.setTimeoutS(10);
abiProc.setCommand({adbToolPath, arguments}); abiProc.setCommand({adbToolPath, arguments});
abiProc.runBlocking(); abiProc.runBlocking();

View File

@@ -196,7 +196,7 @@ void AndroidCreateKeystoreCertificate::buttonBoxAccepted()
"-keypass", certificatePassword(), "-keypass", certificatePassword(),
"-dname", distinguishedNames}); "-dname", distinguishedNames});
SynchronousProcess genKeyCertProc; QtcProcess genKeyCertProc;
genKeyCertProc.setTimeoutS(15); genKeyCertProc.setTimeoutS(15);
genKeyCertProc.setCommand(command); genKeyCertProc.setCommand(command);
genKeyCertProc.setProcessUserEventWhileRunning(); genKeyCertProc.setProcessUserEventWhileRunning();

View File

@@ -480,7 +480,7 @@ void AndroidDeployQtStep::doRun()
void AndroidDeployQtStep::runCommand(const CommandLine &command) void AndroidDeployQtStep::runCommand(const CommandLine &command)
{ {
SynchronousProcess buildProc; QtcProcess buildProc;
buildProc.setTimeoutS(2 * 60); buildProc.setTimeoutS(2 * 60);
emit addOutput(tr("Package deploy: Running command \"%1\".").arg(command.toUserOutput()), emit addOutput(tr("Package deploy: Running command \"%1\".").arg(command.toUserOutput()),
OutputFormat::NormalMessage); OutputFormat::NormalMessage);

View File

@@ -534,7 +534,7 @@ bool AndroidManager::checkKeystorePassword(const QString &keystorePath, const QS
return false; return false;
const CommandLine cmd(AndroidConfigurations::currentConfig().keytoolPath(), const CommandLine cmd(AndroidConfigurations::currentConfig().keytoolPath(),
{"-list", "-keystore", keystorePath, "--storepass", keystorePasswd}); {"-list", "-keystore", keystorePath, "--storepass", keystorePasswd});
SynchronousProcess proc; QtcProcess proc;
proc.setTimeoutS(10); proc.setTimeoutS(10);
proc.setCommand(cmd); proc.setCommand(cmd);
proc.setProcessUserEventWhileRunning(); proc.setProcessUserEventWhileRunning();
@@ -552,7 +552,7 @@ bool AndroidManager::checkCertificatePassword(const QString &keystorePath, const
else else
arguments << certificatePasswd; arguments << certificatePasswd;
SynchronousProcess proc; QtcProcess proc;
proc.setTimeoutS(10); proc.setTimeoutS(10);
proc.setCommand({AndroidConfigurations::currentConfig().keytoolPath(), arguments}); proc.setCommand({AndroidConfigurations::currentConfig().keytoolPath(), arguments});
proc.setProcessUserEventWhileRunning(); proc.setProcessUserEventWhileRunning();
@@ -567,7 +567,7 @@ bool AndroidManager::checkCertificateExists(const QString &keystorePath,
QStringList arguments = { "-list", "-keystore", keystorePath, QStringList arguments = { "-list", "-keystore", keystorePath,
"--storepass", keystorePasswd, "-alias", alias }; "--storepass", keystorePasswd, "-alias", alias };
SynchronousProcess proc; QtcProcess proc;
proc.setTimeoutS(10); proc.setTimeoutS(10);
proc.setCommand({AndroidConfigurations::currentConfig().keytoolPath(), arguments}); proc.setCommand({AndroidConfigurations::currentConfig().keytoolPath(), arguments});
proc.setProcessUserEventWhileRunning(); proc.setProcessUserEventWhileRunning();
@@ -723,7 +723,7 @@ SdkToolResult AndroidManager::runCommand(const CommandLine &command,
const QByteArray &writeData, int timeoutS) const QByteArray &writeData, int timeoutS)
{ {
Android::SdkToolResult cmdResult; Android::SdkToolResult cmdResult;
SynchronousProcess cmdProc; QtcProcess cmdProc;
cmdProc.setTimeoutS(timeoutS); cmdProc.setTimeoutS(timeoutS);
cmdProc.setWriteData(writeData); cmdProc.setWriteData(writeData);
qCDebug(androidManagerLog) << "Running command (sync):" << command.toUserOutput(); qCDebug(androidManagerLog) << "Running command (sync):" << command.toUserOutput();

View File

@@ -123,7 +123,7 @@ static void findProcessPID(QFutureInterface<qint64> &fi, QStringList selector,
chrono::high_resolution_clock::time_point start = chrono::high_resolution_clock::now(); chrono::high_resolution_clock::time_point start = chrono::high_resolution_clock::now();
do { do {
QThread::msleep(200); QThread::msleep(200);
SynchronousProcess proc; QtcProcess proc;
proc.setCommand({adbPath, args}); proc.setCommand({adbPath, args});
proc.runBlocking(); proc.runBlocking();
const QByteArray out = proc.allRawOutput(); const QByteArray out = proc.allRawOutput();

View File

@@ -151,7 +151,7 @@ static bool sdkManagerCommand(const AndroidConfig &config, const QStringList &ar
qCDebug(sdkManagerLog) << "Running SDK Manager command (sync):" qCDebug(sdkManagerLog) << "Running SDK Manager command (sync):"
<< CommandLine(config.sdkManagerToolPath(), newArgs) << CommandLine(config.sdkManagerToolPath(), newArgs)
.toUserOutput(); .toUserOutput();
SynchronousProcess proc; QtcProcess proc;
proc.setEnvironment(AndroidConfigurations::toolsEnvironment(config)); proc.setEnvironment(AndroidConfigurations::toolsEnvironment(config));
proc.setTimeoutS(timeout); proc.setTimeoutS(timeout);
proc.setTimeOutMessageBoxEnabled(true); proc.setTimeOutMessageBoxEnabled(true);
@@ -179,7 +179,7 @@ static void sdkManagerCommand(const AndroidConfig &config, const QStringList &ar
qCDebug(sdkManagerLog) << "Running SDK Manager command (async):" qCDebug(sdkManagerLog) << "Running SDK Manager command (async):"
<< CommandLine(config.sdkManagerToolPath(), newArgs).toUserOutput(); << CommandLine(config.sdkManagerToolPath(), newArgs).toUserOutput();
int offset = fi.progressValue(); int offset = fi.progressValue();
SynchronousProcess proc; QtcProcess proc;
proc.setEnvironment(AndroidConfigurations::toolsEnvironment(config)); proc.setEnvironment(AndroidConfigurations::toolsEnvironment(config));
bool assertionFound = false; bool assertionFound = false;
proc.setTimeoutS(timeout); proc.setTimeoutS(timeout);
@@ -195,7 +195,7 @@ static void sdkManagerCommand(const AndroidConfig &config, const QStringList &ar
}); });
if (interruptible) { if (interruptible) {
QObject::connect(&sdkManager, &AndroidSdkManager::cancelActiveOperations, QObject::connect(&sdkManager, &AndroidSdkManager::cancelActiveOperations,
&proc, &SynchronousProcess::stopProcess); &proc, &QtcProcess::stopProcess);
} }
proc.setCommand({config.sdkManagerToolPath(), newArgs}); proc.setCommand({config.sdkManagerToolPath(), newArgs});
proc.setProcessUserEventWhileRunning(); proc.setProcessUserEventWhileRunning();

View File

@@ -100,7 +100,7 @@ static Macros dumpPredefinedMacros(const FilePath &compiler, const QStringList &
const QString outpath = fakeIn.fileName() + ".tmp"; const QString outpath = fakeIn.fileName() + ".tmp";
SynchronousProcess cpp; QtcProcess cpp;
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
@@ -152,7 +152,7 @@ static HeaderPaths dumpHeaderPaths(const FilePath &compiler, const Id languageId
cmd.addArg("--preinclude"); cmd.addArg("--preinclude");
cmd.addArg("."); cmd.addArg(".");
SynchronousProcess cpp; QtcProcess cpp;
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
cpp.setCommand(cmd); cpp.setCommand(cmd);

View File

@@ -135,7 +135,7 @@ static Macros dumpMcsPredefinedMacros(const FilePath &compiler, const Environmen
fakeIn.close(); fakeIn.close();
SynchronousProcess cpp; QtcProcess cpp;
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
cpp.setCommand({compiler, {fakeIn.fileName()}}); cpp.setCommand({compiler, {fakeIn.fileName()}});
@@ -212,7 +212,7 @@ static Macros dumpC166PredefinedMacros(const FilePath &compiler, const Environme
fakeIn.close(); fakeIn.close();
SynchronousProcess cpp; QtcProcess cpp;
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
@@ -277,7 +277,7 @@ static Macros dumpC166PredefinedMacros(const FilePath &compiler, const Environme
static Macros dumpArmPredefinedMacros(const FilePath &compiler, const QStringList &extraArgs, const Environment &env) static Macros dumpArmPredefinedMacros(const FilePath &compiler, const QStringList &extraArgs, const Environment &env)
{ {
SynchronousProcess cpp; QtcProcess cpp;
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);

View File

@@ -87,7 +87,7 @@ static Macros dumpPredefinedMacros(const FilePath &compiler, const Environment &
return {}; return {};
fakeIn.close(); fakeIn.close();
SynchronousProcess cpp; QtcProcess cpp;
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
cpp.setCommand({compiler, {compilerTargetFlag(abi), "-dM", "-E", fakeIn.fileName()}}); cpp.setCommand({compiler, {compilerTargetFlag(abi), "-dM", "-E", fakeIn.fileName()}});
@@ -108,7 +108,7 @@ static HeaderPaths dumpHeaderPaths(const FilePath &compiler, const Environment &
if (!compiler.exists()) if (!compiler.exists())
return {}; return {};
SynchronousProcess cpp; QtcProcess cpp;
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
cpp.setCommand({compiler, {compilerTargetFlag(abi), "--print-search-dirs"}}); cpp.setCommand({compiler, {compilerTargetFlag(abi), "--print-search-dirs"}});

View File

@@ -150,7 +150,7 @@ bool BazaarClient::synchronousUncommit(const QString &workingDir,
<< revisionSpec(revision) << revisionSpec(revision)
<< extraOptions; << extraOptions;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDir, args); vcsFullySynchronousExec(proc, workingDir, args);
VcsOutputWindow::append(proc.stdOut()); VcsOutputWindow::append(proc.stdOut());
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
@@ -191,7 +191,7 @@ bool BazaarClient::managesFile(const QString &workingDirectory, const QString &f
QStringList args(QLatin1String("status")); QStringList args(QLatin1String("status"));
args << fileName; args << fileName;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, args); vcsFullySynchronousExec(proc, workingDirectory, args);
if (proc.result() != QtcProcess::FinishedWithSuccess) if (proc.result() != QtcProcess::FinishedWithSuccess)
return false; return false;

View File

@@ -83,7 +83,7 @@ static int parseVersion(const QString &text)
static int updateVersionHelper(const Utils::FilePath &command) static int updateVersionHelper(const Utils::FilePath &command)
{ {
Utils::SynchronousProcess process; Utils::QtcProcess process;
process.setCommand({command, {"--version"}}); process.setCommand({command, {"--version"}});
process.runBlocking(); process.runBlocking();
if (process.result() != Utils::QtcProcess::FinishedWithSuccess) if (process.result() != Utils::QtcProcess::FinishedWithSuccess)
@@ -180,7 +180,7 @@ QString ArtisticStyleSettings::documentationFilePath() const
void ArtisticStyleSettings::createDocumentationFile() const void ArtisticStyleSettings::createDocumentationFile() const
{ {
Utils::SynchronousProcess process; Utils::QtcProcess process;
process.setTimeoutS(2); process.setTimeoutS(2);
process.setCommand({command(), {"-h"}}); process.setCommand({command(), {"-h"}});
process.runBlocking(); process.runBlocking();

View File

@@ -148,7 +148,7 @@ QString UncrustifySettings::documentationFilePath() const
void UncrustifySettings::createDocumentationFile() const void UncrustifySettings::createDocumentationFile() const
{ {
Utils::SynchronousProcess process; Utils::QtcProcess process;
process.setTimeoutS(2); process.setTimeoutS(2);
process.setCommand({command(), {"--show-config"}}); process.setCommand({command(), {"--show-config"}});
process.runBlocking(); process.runBlocking();

View File

@@ -104,7 +104,7 @@ bool ClangToolRunner::supportsVFSOverlay() const
static QMap<QString, bool> vfsCapabilities; static QMap<QString, bool> vfsCapabilities;
auto it = vfsCapabilities.find(m_executable); auto it = vfsCapabilities.find(m_executable);
if (it == vfsCapabilities.end()) { if (it == vfsCapabilities.end()) {
SynchronousProcess p; QtcProcess p;
p.setCommand({m_executable, {"--help"}}); p.setCommand({m_executable, {"--help"}});
p.runBlocking(); p.runBlocking();
it = vfsCapabilities.insert(m_executable, p.allOutput().contains("vfsoverlay")); it = vfsCapabilities.insert(m_executable, p.allOutput().contains("vfsoverlay"));

View File

@@ -50,7 +50,7 @@ static QString runExecutable(const Utils::CommandLine &commandLine,
if (commandLine.executable().isEmpty() || !commandLine.executable().toFileInfo().isExecutable()) if (commandLine.executable().isEmpty() || !commandLine.executable().toFileInfo().isExecutable())
return {}; return {};
SynchronousProcess cpp; QtcProcess cpp;
Environment env = Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();
env.setupEnglishOutput(); env.setupEnglishOutput();
cpp.setEnvironment(env); cpp.setEnvironment(env);

View File

@@ -1667,7 +1667,7 @@ ClearCasePluginPrivate::runCleartool(const QString &workingDir,
return response; return response;
} }
SynchronousProcess proc; QtcProcess proc;
proc.setTimeoutS(timeOutS); proc.setTimeoutS(timeOutS);
VcsCommand command(workingDir, Environment::systemEnvironment()); VcsCommand command(workingDir, Environment::systemEnvironment());
@@ -2355,7 +2355,7 @@ QString ClearCasePluginPrivate::runExtDiff(const QString &workingDir, const QStr
diff.addArgs(m_settings.diffArgs.split(' ', Qt::SkipEmptyParts)); diff.addArgs(m_settings.diffArgs.split(' ', Qt::SkipEmptyParts));
diff.addArgs(arguments); diff.addArgs(arguments);
SynchronousProcess process; QtcProcess process;
process.setTimeoutS(timeOutS); process.setTimeoutS(timeOutS);
process.setWorkingDirectory(workingDir); process.setWorkingDirectory(workingDir);
process.setCodec(outputCodec ? outputCodec : QTextCodec::codecForName("UTF-8")); process.setCodec(outputCodec ? outputCodec : QTextCodec::codecForName("UTF-8"));

View File

@@ -198,7 +198,7 @@ static FilePath qmakeFromCMakeCache(const CMakeConfig &config)
)); ));
cmakeListTxt.close(); cmakeListTxt.close();
SynchronousProcess cmake; QtcProcess cmake;
cmake.setTimeoutS(5); cmake.setTimeoutS(5);
cmake.setDisableUnixTerminal(); cmake.setDisableUnixTerminal();
Environment env = Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();

View File

@@ -268,7 +268,7 @@ TextEditor::Keywords CMakeTool::keywords()
return {}; return {};
if (m_introspection->m_functions.isEmpty() && m_introspection->m_didRun) { if (m_introspection->m_functions.isEmpty() && m_introspection->m_didRun) {
SynchronousProcess proc; QtcProcess proc;
runCMake(proc, {"--help-command-list"}, 5); runCMake(proc, {"--help-command-list"}, 5);
if (proc.result() == QtcProcess::FinishedWithSuccess) if (proc.result() == QtcProcess::FinishedWithSuccess)
m_introspection->m_functions = proc.stdOut().split('\n'); m_introspection->m_functions = proc.stdOut().split('\n');
@@ -481,7 +481,7 @@ QStringList CMakeTool::parseVariableOutput(const QString &output)
void CMakeTool::fetchFromCapabilities() const void CMakeTool::fetchFromCapabilities() const
{ {
SynchronousProcess cmake; QtcProcess cmake;
runCMake(cmake, {"-E", "capabilities"}); runCMake(cmake, {"-E", "capabilities"});
if (cmake.result() == QtcProcess::FinishedWithSuccess) { if (cmake.result() == QtcProcess::FinishedWithSuccess) {

View File

@@ -427,7 +427,7 @@ static std::function<void(QFileInfo)> postCopyOperation()
return; return;
// On macOS, downloaded files get a quarantine flag, remove it, otherwise it is a hassle // On macOS, downloaded files get a quarantine flag, remove it, otherwise it is a hassle
// to get it loaded as a plugin in Qt Creator. // to get it loaded as a plugin in Qt Creator.
SynchronousProcess xattr; QtcProcess xattr;
xattr.setTimeoutS(1); xattr.setTimeoutS(1);
xattr.setCommand({"/usr/bin/xattr", {"-d", "com.apple.quarantine", fi.absoluteFilePath()}}); xattr.setCommand({"/usr/bin/xattr", {"-d", "com.apple.quarantine", fi.absoluteFilePath()}});
xattr.runBlocking(); xattr.runBlocking();

View File

@@ -1446,7 +1446,7 @@ CvsResponse CvsPluginPrivate::runCvs(const QString &workingDirectory,
return response; return response;
} }
// Run, connect stderr to the output window // Run, connect stderr to the output window
SynchronousProcess proc; QtcProcess proc;
proc.setTimeoutS(timeOutS); proc.setTimeoutS(timeOutS);
VcsCommand command(workingDirectory, Environment::systemEnvironment()); VcsCommand command(workingDirectory, Environment::systemEnvironment());

View File

@@ -69,7 +69,7 @@ const char DEBUGGER_INFORMATION_WORKINGDIRECTORY[] = "WorkingDirectory";
static QString getConfigurationOfGdbCommand(const FilePath &command, const Utils::Environment &sysEnv) static QString getConfigurationOfGdbCommand(const FilePath &command, const Utils::Environment &sysEnv)
{ {
// run gdb with the --configuration opion // run gdb with the --configuration opion
SynchronousProcess proc; QtcProcess proc;
proc.setEnvironment(sysEnv); proc.setEnvironment(sysEnv);
proc.setCommand({command, {"--configuration"}}); proc.setCommand({command, {"--configuration"}});
proc.runBlocking(); proc.runBlocking();
@@ -184,7 +184,7 @@ void DebuggerItem::reinitializeFromFile(const Utils::Environment &sysEnv)
return; return;
} }
SynchronousProcess proc; QtcProcess proc;
proc.setEnvironment(sysEnv); proc.setEnvironment(sysEnv);
proc.setCommand({m_command, {version}}); proc.setCommand({m_command, {version}});
proc.runBlocking(); proc.runBlocking();

View File

@@ -747,7 +747,7 @@ void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePath &de
FilePaths suspects; FilePaths suspects;
if (device->osType() == OsTypeMac) { if (device->osType() == OsTypeMac) {
SynchronousProcess proc; QtcProcess proc;
proc.setTimeoutS(2); proc.setTimeoutS(2);
proc.setCommand({"xcrun", {"--find", "lldb"}}); proc.setCommand({"xcrun", {"--find", "lldb"}});
proc.runBlocking(); proc.runBlocking();

View File

@@ -4984,7 +4984,7 @@ CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QS
args += {"-ex", "set osabi GNU/Linux"}; args += {"-ex", "set osabi GNU/Linux"};
args += {"-ex", "core " + coreFile}; args += {"-ex", "core " + coreFile};
SynchronousProcess proc; QtcProcess proc;
Environment envLang(Environment::systemEnvironment()); Environment envLang(Environment::systemEnvironment());
envLang.setupEnglishOutput(); envLang.setupEnglishOutput();
proc.setEnvironment(envLang); proc.setEnvironment(envLang);

View File

@@ -992,7 +992,7 @@ void DockerDevice::aboutToBeRemoved() const
void DockerDevicePrivate::fetchSystemEnviroment() void DockerDevicePrivate::fetchSystemEnviroment()
{ {
SynchronousProcess proc; QtcProcess proc;
proc.setCommand({"env", {}}); proc.setCommand({"env", {}});
q->runProcess(proc); // FIXME: This only starts. q->runProcess(proc); // FIXME: This only starts.

View File

@@ -244,7 +244,7 @@ int GerritServer::testConnection()
{ {
static GitClient *const client = GitClient::instance(); static GitClient *const client = GitClient::instance();
const QStringList arguments = curlArguments() << (url(RestUrl) + accountUrlC); const QStringList arguments = curlArguments() << (url(RestUrl) + accountUrlC);
SynchronousProcess proc; QtcProcess proc;
client->vcsFullySynchronousExec(proc, QString(), {curlBinary, arguments}, client->vcsFullySynchronousExec(proc, QString(), {curlBinary, arguments},
Core::ShellCommand::NoOutput); Core::ShellCommand::NoOutput);
if (proc.result() == QtcProcess::FinishedWithSuccess) { if (proc.result() == QtcProcess::FinishedWithSuccess) {
@@ -341,7 +341,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
if (!version.isEmpty() && !forceReload) if (!version.isEmpty() && !forceReload)
return; return;
if (type == Ssh) { if (type == Ssh) {
SynchronousProcess proc; QtcProcess proc;
QStringList arguments; QStringList arguments;
if (port) if (port)
arguments << p.portFlag << QString::number(port); arguments << p.portFlag << QString::number(port);
@@ -353,7 +353,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
version = stdOut; version = stdOut;
} else { } else {
const QStringList arguments = curlArguments() << (url(RestUrl) + versionUrlC); const QStringList arguments = curlArguments() << (url(RestUrl) + versionUrlC);
SynchronousProcess proc; QtcProcess proc;
client->vcsFullySynchronousExec(proc, QString(), {curlBinary, arguments}, client->vcsFullySynchronousExec(proc, QString(), {curlBinary, arguments},
Core::ShellCommand::NoOutput); Core::ShellCommand::NoOutput);
// REST endpoint for version is only available from 2.8 and up. Do not consider invalid // REST endpoint for version is only available from 2.8 and up. Do not consider invalid

View File

@@ -669,7 +669,7 @@ public:
connect(command, &VcsCommand::stdErrText, handler, &ConflictHandler::readStdErr); connect(command, &VcsCommand::stdErrText, handler, &ConflictHandler::readStdErr);
} }
static void handleResponse(const Utils::SynchronousProcess &proc, static void handleResponse(const Utils::QtcProcess &proc,
const QString &workingDirectory, const QString &workingDirectory,
const QString &abortCommand = QString()) const QString &abortCommand = QString())
{ {
@@ -838,7 +838,7 @@ QString GitClient::findGitDirForRepository(const QString &repositoryDir) const
bool GitClient::managesFile(const QString &workingDirectory, const QString &fileName) const bool GitClient::managesFile(const QString &workingDirectory, const QString &fileName) const
{ {
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"ls-files", "--error-unmatch", fileName}, vcsFullySynchronousExec(proc, workingDirectory, {"ls-files", "--error-unmatch", fileName},
Core::ShellCommand::NoOutput); Core::ShellCommand::NoOutput);
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
@@ -856,7 +856,7 @@ QStringList GitClient::unmanagedFiles(const QStringList &filePaths) const
QStringList args({"ls-files", "-z"}); QStringList args({"ls-files", "-z"});
const QDir wd(it.key()); const QDir wd(it.key());
args << transform(it.value(), [&wd](const QString &fp) { return wd.relativeFilePath(fp); }); args << transform(it.value(), [&wd](const QString &fp) { return wd.relativeFilePath(fp); });
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, it.key(), args, Core::ShellCommand::NoOutput); vcsFullySynchronousExec(proc, it.key(), args, Core::ShellCommand::NoOutput);
if (proc.result() != QtcProcess::FinishedWithSuccess) if (proc.result() != QtcProcess::FinishedWithSuccess)
return filePaths; return filePaths;
@@ -1424,7 +1424,7 @@ void GitClient::removeStaleRemoteBranches(const QString &workingDirectory, const
void GitClient::recoverDeletedFiles(const QString &workingDirectory) void GitClient::recoverDeletedFiles(const QString &workingDirectory)
{ {
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"ls-files", "--deleted"}, vcsFullySynchronousExec(proc, workingDirectory, {"ls-files", "--deleted"},
VcsCommand::SuppressCommandLogging); VcsCommand::SuppressCommandLogging);
if (proc.result() == QtcProcess::FinishedWithSuccess) { if (proc.result() == QtcProcess::FinishedWithSuccess) {
@@ -1451,7 +1451,7 @@ bool GitClient::synchronousLog(const QString &workingDirectory, const QStringLis
allArguments.append(arguments); allArguments.append(arguments);
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, allArguments, flags, vcsTimeoutS(), vcsFullySynchronousExec(proc, workingDirectory, allArguments, flags, vcsTimeoutS(),
encoding(workingDirectory, "i18n.logOutputEncoding")); encoding(workingDirectory, "i18n.logOutputEncoding"));
if (proc.result() == QtcProcess::FinishedWithSuccess) { if (proc.result() == QtcProcess::FinishedWithSuccess) {
@@ -1470,7 +1470,7 @@ bool GitClient::synchronousAdd(const QString &workingDirectory,
{ {
QStringList args{"add"}; QStringList args{"add"};
args += extraOptions + files; args += extraOptions + files;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, args); vcsFullySynchronousExec(proc, workingDirectory, args);
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
} }
@@ -1483,7 +1483,7 @@ bool GitClient::synchronousDelete(const QString &workingDirectory,
if (force) if (force)
arguments << "--force"; arguments << "--force";
arguments.append(files); arguments.append(files);
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments); vcsFullySynchronousExec(proc, workingDirectory, arguments);
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
} }
@@ -1492,7 +1492,7 @@ bool GitClient::synchronousMove(const QString &workingDirectory,
const QString &from, const QString &from,
const QString &to) const QString &to)
{ {
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"mv", from, to}); vcsFullySynchronousExec(proc, workingDirectory, {"mv", from, to});
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
} }
@@ -1507,7 +1507,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
else else
arguments << HEAD << "--" << files; arguments << HEAD << "--" << files;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments); vcsFullySynchronousExec(proc, workingDirectory, arguments);
const QString stdOut = proc.stdOut(); const QString stdOut = proc.stdOut();
VcsOutputWindow::append(stdOut); VcsOutputWindow::append(stdOut);
@@ -1531,7 +1531,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
// Initialize repository // Initialize repository
bool GitClient::synchronousInit(const QString &workingDirectory) bool GitClient::synchronousInit(const QString &workingDirectory)
{ {
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, QStringList{"init"}); vcsFullySynchronousExec(proc, workingDirectory, QStringList{"init"});
// '[Re]Initialized...' // '[Re]Initialized...'
VcsOutputWindow::append(proc.stdOut()); VcsOutputWindow::append(proc.stdOut());
@@ -1559,7 +1559,7 @@ bool GitClient::synchronousCheckoutFiles(const QString &workingDirectory, QStrin
if (revertStaging) if (revertStaging)
arguments << revision; arguments << revision;
arguments << "--" << files; arguments << "--" << files;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, VcsCommand::ExpectRepoChanges); vcsFullySynchronousExec(proc, workingDirectory, arguments, VcsCommand::ExpectRepoChanges);
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
const QString fileArg = files.join(", "); const QString fileArg = files.join(", ");
@@ -1610,7 +1610,7 @@ bool GitClient::synchronousRevListCmd(const QString &workingDirectory, const QSt
QString *output, QString *errorMessage) const QString *output, QString *errorMessage) const
{ {
const QStringList arguments = QStringList({"rev-list", noColorOption}) + extraArguments; const QStringList arguments = QStringList({"rev-list", noColorOption}) + extraArguments;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags);
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage); msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage);
@@ -1674,7 +1674,7 @@ QString GitClient::synchronousShortDescription(const QString &workingDirectory,
QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory) const QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory) const
{ {
QString branch; QString branch;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"symbolic-ref", HEAD}, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, {"symbolic-ref", HEAD}, silentFlags);
if (proc.result() == QtcProcess::FinishedWithSuccess) { if (proc.result() == QtcProcess::FinishedWithSuccess) {
branch = proc.stdOut().trimmed(); branch = proc.stdOut().trimmed();
@@ -1699,7 +1699,7 @@ bool GitClient::synchronousHeadRefs(const QString &workingDirectory, QStringList
QString *errorMessage) const QString *errorMessage) const
{ {
const QStringList arguments = {"show-ref", "--head", "--abbrev=10", "--dereference"}; const QStringList arguments = {"show-ref", "--head", "--abbrev=10", "--dereference"};
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags);
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage); msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage);
@@ -1748,7 +1748,7 @@ QString GitClient::synchronousTopic(const QString &workingDirectory) const
return remoteBranch; return remoteBranch;
// No tag or remote branch - try git describe // No tag or remote branch - try git describe
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, QStringList{"describe"}, VcsCommand::NoOutput); vcsFullySynchronousExec(proc, workingDirectory, QStringList{"describe"}, VcsCommand::NoOutput);
if (proc.result() == QtcProcess::FinishedWithSuccess) { if (proc.result() == QtcProcess::FinishedWithSuccess) {
const QString stdOut = proc.stdOut().trimmed(); const QString stdOut = proc.stdOut().trimmed();
@@ -1762,7 +1762,7 @@ bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QS
QString *output, QString *errorMessage) const QString *output, QString *errorMessage) const
{ {
const QStringList arguments = {"rev-parse", ref}; const QStringList arguments = {"rev-parse", ref};
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags);
*output = proc.stdOut().trimmed(); *output = proc.stdOut().trimmed();
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
@@ -1777,7 +1777,7 @@ bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QS
QString GitClient::synchronousTopRevision(const QString &workingDirectory, QDateTime *dateTime) QString GitClient::synchronousTopRevision(const QString &workingDirectory, QDateTime *dateTime)
{ {
const QStringList arguments = {"show", "-s", "--pretty=format:%H:%ct", HEAD}; const QStringList arguments = {"show", "-s", "--pretty=format:%H:%ct", HEAD};
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags);
if (proc.result() != QtcProcess::FinishedWithSuccess) if (proc.result() != QtcProcess::FinishedWithSuccess)
return QString(); return QString();
@@ -1793,7 +1793,7 @@ QString GitClient::synchronousTopRevision(const QString &workingDirectory, QDate
void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const QString &revision, void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const QString &revision,
QString &precedes, QString &follows) const QString &precedes, QString &follows) const
{ {
SynchronousProcess proc1; QtcProcess proc1;
vcsFullySynchronousExec(proc1, workingDirectory, {"describe", "--contains", revision}, silentFlags); vcsFullySynchronousExec(proc1, workingDirectory, {"describe", "--contains", revision}, silentFlags);
precedes = proc1.stdOut(); precedes = proc1.stdOut();
int tilde = precedes.indexOf('~'); int tilde = precedes.indexOf('~');
@@ -1806,7 +1806,7 @@ void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const
QString errorMessage; QString errorMessage;
synchronousParentRevisions(workingDirectory, revision, &parents, &errorMessage); synchronousParentRevisions(workingDirectory, revision, &parents, &errorMessage);
for (const QString &p : qAsConst(parents)) { for (const QString &p : qAsConst(parents)) {
SynchronousProcess proc2; QtcProcess proc2;
vcsFullySynchronousExec(proc2, vcsFullySynchronousExec(proc2,
workingDirectory, {"describe", "--tags", "--abbrev=0", p}, silentFlags); workingDirectory, {"describe", "--tags", "--abbrev=0", p}, silentFlags);
QString pf = proc2.stdOut(); QString pf = proc2.stdOut();
@@ -1821,14 +1821,14 @@ void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const
bool GitClient::isRemoteCommit(const QString &workingDirectory, const QString &commit) bool GitClient::isRemoteCommit(const QString &workingDirectory, const QString &commit)
{ {
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"branch", "-r", "--contains", commit}, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, {"branch", "-r", "--contains", commit}, silentFlags);
return proc.rawStdOut().isEmpty(); return proc.rawStdOut().isEmpty();
} }
bool GitClient::isFastForwardMerge(const QString &workingDirectory, const QString &branch) bool GitClient::isFastForwardMerge(const QString &workingDirectory, const QString &branch)
{ {
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"merge-base", HEAD, branch}, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, {"merge-base", HEAD, branch}, silentFlags);
return proc.stdOut().trimmed() == synchronousTopRevision(workingDirectory); return proc.stdOut().trimmed() == synchronousTopRevision(workingDirectory);
} }
@@ -1839,7 +1839,7 @@ QString GitClient::synchronousShortDescription(const QString &workingDirectory,
{ {
const QStringList arguments = {"log", noColorOption, ("--pretty=format:" + format), const QStringList arguments = {"log", noColorOption, ("--pretty=format:" + format),
"--max-count=1", revision}; "--max-count=1", revision};
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags);
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
VcsOutputWindow::appendSilently(tr("Cannot describe revision \"%1\" in \"%2\": %3") VcsOutputWindow::appendSilently(tr("Cannot describe revision \"%1\" in \"%2\": %3")
@@ -1920,7 +1920,7 @@ bool GitClient::executeSynchronousStash(const QString &workingDirectory,
const unsigned flags = VcsCommand::ShowStdOut const unsigned flags = VcsCommand::ShowStdOut
| VcsCommand::ExpectRepoChanges | VcsCommand::ExpectRepoChanges
| VcsCommand::ShowSuccessMessage; | VcsCommand::ShowSuccessMessage;
SynchronousProcess proc; QtcProcess proc;
vcsSynchronousExec(proc, workingDirectory, arguments, flags); vcsSynchronousExec(proc, workingDirectory, arguments, flags);
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage); msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage);
@@ -1960,7 +1960,7 @@ bool GitClient::synchronousBranchCmd(const QString &workingDirectory, QStringLis
QString *output, QString *errorMessage) const QString *output, QString *errorMessage) const
{ {
branchArgs.push_front("branch"); branchArgs.push_front("branch");
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, branchArgs); vcsFullySynchronousExec(proc, workingDirectory, branchArgs);
*output = proc.stdOut(); *output = proc.stdOut();
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
@@ -1974,7 +1974,7 @@ bool GitClient::synchronousTagCmd(const QString &workingDirectory, QStringList t
QString *output, QString *errorMessage) const QString *output, QString *errorMessage) const
{ {
tagArgs.push_front("tag"); tagArgs.push_front("tag");
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, tagArgs); vcsFullySynchronousExec(proc, workingDirectory, tagArgs);
*output = proc.stdOut(); *output = proc.stdOut();
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
@@ -1988,7 +1988,7 @@ bool GitClient::synchronousForEachRefCmd(const QString &workingDirectory, QStrin
QString *output, QString *errorMessage) const QString *output, QString *errorMessage) const
{ {
args.push_front("for-each-ref"); args.push_front("for-each-ref");
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, args, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, args, silentFlags);
*output = proc.stdOut(); *output = proc.stdOut();
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
@@ -2008,7 +2008,7 @@ bool GitClient::synchronousRemoteCmd(const QString &workingDirectory, QStringLis
QString *output, QString *errorMessage, bool silent) const QString *output, QString *errorMessage, bool silent) const
{ {
remoteArgs.push_front("remote"); remoteArgs.push_front("remote");
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, remoteArgs, silent ? silentFlags : 0); vcsFullySynchronousExec(proc, workingDirectory, remoteArgs, silent ? silentFlags : 0);
const QString stdErr = proc.stdErr(); const QString stdErr = proc.stdErr();
@@ -2052,7 +2052,7 @@ QStringList GitClient::synchronousSubmoduleStatus(const QString &workingDirector
QString *errorMessage) const QString *errorMessage) const
{ {
// get submodule status // get submodule status
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"submodule", "status"}, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, {"submodule", "status"}, silentFlags);
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
@@ -2133,7 +2133,7 @@ QByteArray GitClient::synchronousShow(const QString &workingDirectory, const QSt
return {}; return {};
} }
const QStringList arguments = {"show", decorateOption, noColorOption, "--no-patch", id}; const QStringList arguments = {"show", decorateOption, noColorOption, "--no-patch", id};
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, flags); vcsFullySynchronousExec(proc, workingDirectory, arguments, flags);
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), nullptr); msgCannotRun(arguments, workingDirectory, proc.stdErr(), nullptr);
@@ -2149,7 +2149,7 @@ bool GitClient::cleanList(const QString &workingDirectory, const QString &module
const QString directory = workingDirectory + '/' + modulePath; const QString directory = workingDirectory + '/' + modulePath;
const QStringList arguments = {"clean", "--dry-run", flag}; const QStringList arguments = {"clean", "--dry-run", flag};
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, directory, arguments, VcsCommand::ForceCLocale); vcsFullySynchronousExec(proc, directory, arguments, VcsCommand::ForceCLocale);
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
msgCannotRun(arguments, directory, proc.stdErr(), errorMessage); msgCannotRun(arguments, directory, proc.stdErr(), errorMessage);
@@ -2196,7 +2196,7 @@ bool GitClient::synchronousApplyPatch(const QString &workingDirectory,
QStringList arguments = {"apply", "--whitespace=fix"}; QStringList arguments = {"apply", "--whitespace=fix"};
arguments << extraArguments << file; arguments << extraArguments << file;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments); vcsFullySynchronousExec(proc, workingDirectory, arguments);
const QString stdErr = proc.stdErr(); const QString stdErr = proc.stdErr();
if (proc.result() == QtcProcess::FinishedWithSuccess) { if (proc.result() == QtcProcess::FinishedWithSuccess) {
@@ -2325,7 +2325,7 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory, St
arguments << "--ignore-submodules=all"; arguments << "--ignore-submodules=all";
arguments << "--porcelain" << "-b"; arguments << "--porcelain" << "-b";
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags);
const QString stdOut = proc.stdOut(); const QString stdOut = proc.stdOut();
@@ -2493,7 +2493,7 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
const unsigned flags = VcsCommand::SshPasswordPrompt const unsigned flags = VcsCommand::SshPasswordPrompt
| VcsCommand::SuppressStdErr | VcsCommand::SuppressStdErr
| VcsCommand::SuppressFailMessage; | VcsCommand::SuppressFailMessage;
SynchronousProcess proc; QtcProcess proc;
vcsSynchronousExec(proc, vcsSynchronousExec(proc,
workingDirectory, {"ls-remote", repositoryURL, HEAD, "refs/heads/*"}, flags); workingDirectory, {"ls-remote", repositoryURL, HEAD, "refs/heads/*"}, flags);
QStringList branches; QStringList branches;
@@ -2708,7 +2708,7 @@ bool GitClient::readDataFromCommit(const QString &repoDirectory, const QString &
{ {
// Get commit data as "SHA1<lf>author<lf>email<lf>message". // Get commit data as "SHA1<lf>author<lf>email<lf>message".
const QStringList arguments = {"log", "--max-count=1", "--pretty=format:%h\n%an\n%ae\n%B", commit}; const QStringList arguments = {"log", "--max-count=1", "--pretty=format:%h\n%an\n%ae\n%B", commit};
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, repoDirectory, arguments, silentFlags); vcsFullySynchronousExec(proc, repoDirectory, arguments, silentFlags);
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
@@ -2965,7 +2965,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
arguments << "--signoff"; arguments << "--signoff";
} }
SynchronousProcess proc; QtcProcess proc;
vcsSynchronousExec(proc, repositoryDirectory, arguments, VcsCommand::NoFullySync); vcsSynchronousExec(proc, repositoryDirectory, arguments, VcsCommand::NoFullySync);
if (proc.result() == QtcProcess::FinishedWithSuccess) { if (proc.result() == QtcProcess::FinishedWithSuccess) {
VcsOutputWindow::appendMessage(msgCommitted(amendSHA1, commitCount)); VcsOutputWindow::appendMessage(msgCommitted(amendSHA1, commitCount));
@@ -3104,7 +3104,7 @@ bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
| VcsCommand::ShowStdOut | VcsCommand::ShowStdOut
| VcsCommand::ExpectRepoChanges | VcsCommand::ExpectRepoChanges
| VcsCommand::ShowSuccessMessage; | VcsCommand::ShowSuccessMessage;
SynchronousProcess proc; QtcProcess proc;
vcsSynchronousExec(proc, workingDirectory, arguments, flags); vcsSynchronousExec(proc, workingDirectory, arguments, flags);
// Notify about changed files or abort the rebase. // Notify about changed files or abort the rebase.
ConflictHandler::handleResponse(proc, workingDirectory, abortCommand); ConflictHandler::handleResponse(proc, workingDirectory, abortCommand);
@@ -3138,7 +3138,7 @@ void GitClient::synchronousAbortCommand(const QString &workingDir, const QString
return; return;
} }
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDir, {abortCommand, "--abort"}, vcsFullySynchronousExec(proc, workingDir, {abortCommand, "--abort"},
VcsCommand::ExpectRepoChanges | VcsCommand::ShowSuccessMessage); VcsCommand::ExpectRepoChanges | VcsCommand::ShowSuccessMessage);
VcsOutputWindow::append(proc.stdOut()); VcsOutputWindow::append(proc.stdOut());
@@ -3164,7 +3164,7 @@ QString GitClient::synchronousTrackingBranch(const QString &workingDirectory, co
bool GitClient::synchronousSetTrackingBranch(const QString &workingDirectory, bool GitClient::synchronousSetTrackingBranch(const QString &workingDirectory,
const QString &branch, const QString &tracking) const QString &branch, const QString &tracking)
{ {
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, vcsFullySynchronousExec(proc,
workingDirectory, {"branch", "--set-upstream-to=" + tracking, branch}); workingDirectory, {"branch", "--set-upstream-to=" + tracking, branch});
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
@@ -3238,7 +3238,7 @@ void GitClient::synchronousSubversionFetch(const QString &workingDirectory) cons
const unsigned flags = VcsCommand::SshPasswordPrompt const unsigned flags = VcsCommand::SshPasswordPrompt
| VcsCommand::ShowStdOut | VcsCommand::ShowStdOut
| VcsCommand::ShowSuccessMessage; | VcsCommand::ShowSuccessMessage;
SynchronousProcess proc; QtcProcess proc;
vcsSynchronousExec(proc, workingDirectory, {"svn", "fetch"}, flags); vcsSynchronousExec(proc, workingDirectory, {"svn", "fetch"}, flags);
} }
@@ -3488,7 +3488,7 @@ bool GitClient::synchronousStashRemove(const QString &workingDirectory, const QS
else else
arguments << "drop" << stash; arguments << "drop" << stash;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments); vcsFullySynchronousExec(proc, workingDirectory, arguments);
if (proc.result() == QtcProcess::FinishedWithSuccess) { if (proc.result() == QtcProcess::FinishedWithSuccess) {
const QString output = proc.stdOut(); const QString output = proc.stdOut();
@@ -3507,7 +3507,7 @@ bool GitClient::synchronousStashList(const QString &workingDirectory, QList<Stas
stashes->clear(); stashes->clear();
const QStringList arguments = {"stash", "list", noColorOption}; const QStringList arguments = {"stash", "list", noColorOption};
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, VcsCommand::ForceCLocale); vcsFullySynchronousExec(proc, workingDirectory, arguments, VcsCommand::ForceCLocale);
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage); msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage);
@@ -3547,7 +3547,7 @@ QString GitClient::readOneLine(const QString &workingDirectory, const QStringLis
? QTextCodec::codecForName("UTF-8") ? QTextCodec::codecForName("UTF-8")
: QTextCodec::codecForLocale(); : QTextCodec::codecForLocale();
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags, vcsTimeoutS(), codec); vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags, vcsTimeoutS(), codec);
if (proc.result() != QtcProcess::FinishedWithSuccess) if (proc.result() != QtcProcess::FinishedWithSuccess)
return QString(); return QString();
@@ -3574,7 +3574,7 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const
return 0; return 0;
// run git --version // run git --version
SynchronousProcess proc; QtcProcess proc;
vcsSynchronousExec(proc, QString(), {"--version"}, silentFlags); vcsSynchronousExec(proc, QString(), {"--version"}, silentFlags);
if (proc.result() != QtcProcess::FinishedWithSuccess) { if (proc.result() != QtcProcess::FinishedWithSuccess) {
msgCannotRun(tr("Cannot determine Git version: %1").arg(proc.stdErr()), errorMessage); msgCannotRun(tr("Cannot determine Git version: %1").arg(proc.stdErr()), errorMessage);

View File

@@ -198,7 +198,7 @@ public:
QObject::connect(m_command.get(), QObject::connect(m_command.get(),
&VcsCommand::stdOutText, &VcsCommand::stdOutText,
[this, &fi](const QString &text) { read(fi, text); }); [this, &fi](const QString &text) { read(fi, text); });
SynchronousProcess proc; QtcProcess proc;
proc.setTimeoutS(0); proc.setTimeoutS(0);
m_command->runCommand(proc, {m_vcsBinary, arguments}); m_command->runCommand(proc, {m_vcsBinary, arguments});
switch (proc.result()) { switch (proc.result()) {

View File

@@ -232,7 +232,7 @@ static QByteArray decodeProvisioningProfile(const QString &path)
{ {
QTC_ASSERT(!path.isEmpty(), return QByteArray()); QTC_ASSERT(!path.isEmpty(), return QByteArray());
Utils::SynchronousProcess p; Utils::QtcProcess p;
p.setTimeoutS(3); p.setTimeoutS(3);
// path is assumed to be valid file path to .mobileprovision // path is assumed to be valid file path to .mobileprovision
p.setCommand({"openssl", {"smime", "-inform", "der", "-verify", "-in", path}}); p.setCommand({"openssl", {"smime", "-inform", "der", "-verify", "-in", path}});

View File

@@ -65,7 +65,7 @@ void XcodeProbe::addDeveloperPath(const QString &path)
void XcodeProbe::detectDeveloperPaths() void XcodeProbe::detectDeveloperPaths()
{ {
Utils::SynchronousProcess selectedXcode; Utils::QtcProcess selectedXcode;
selectedXcode.setTimeoutS(5); selectedXcode.setTimeoutS(5);
selectedXcode.setCommand({"/usr/bin/xcode-select", {"--print-path"}}); selectedXcode.setCommand({"/usr/bin/xcode-select", {"--print-path"}});
selectedXcode.runBlocking(); selectedXcode.runBlocking();

View File

@@ -81,7 +81,7 @@ static bool checkForTimeout(const chrono::high_resolution_clock::time_point &sta
static bool runCommand(const CommandLine &command, QString *stdOutput, QString *allOutput = nullptr) static bool runCommand(const CommandLine &command, QString *stdOutput, QString *allOutput = nullptr)
{ {
SynchronousProcess p; QtcProcess p;
p.setTimeoutS(-1); p.setTimeoutS(-1);
p.setCommand(command); p.setCommand(command);
p.runBlocking(); p.runBlocking();

View File

@@ -96,7 +96,7 @@ bool MercurialClient::manifestSync(const QString &repository, const QString &rel
// This only works when called from the repo and outputs paths relative to it. // This only works when called from the repo and outputs paths relative to it.
const QStringList args(QLatin1String("manifest")); const QStringList args(QLatin1String("manifest"));
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, repository, args); vcsFullySynchronousExec(proc, repository, args);
const QDir repositoryDir(repository); const QDir repositoryDir(repository);
@@ -127,7 +127,7 @@ bool MercurialClient::synchronousClone(const QString &workingDir,
if (workingDirectory.exists()) { if (workingDirectory.exists()) {
// Let's make first init // Let's make first init
QStringList arguments(QLatin1String("init")); QStringList arguments(QLatin1String("init"));
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory.path(), arguments); vcsFullySynchronousExec(proc, workingDirectory.path(), arguments);
if (proc.result() != QtcProcess::FinishedWithSuccess) if (proc.result() != QtcProcess::FinishedWithSuccess)
return false; return false;
@@ -135,7 +135,7 @@ bool MercurialClient::synchronousClone(const QString &workingDir,
// Then pull remote repository // Then pull remote repository
arguments.clear(); arguments.clear();
arguments << QLatin1String("pull") << dstLocation; arguments << QLatin1String("pull") << dstLocation;
SynchronousProcess proc1; QtcProcess proc1;
vcsSynchronousExec(proc1, workingDirectory.path(), arguments, flags); vcsSynchronousExec(proc1, workingDirectory.path(), arguments, flags);
if (proc1.result() != QtcProcess::FinishedWithSuccess) if (proc1.result() != QtcProcess::FinishedWithSuccess)
return false; return false;
@@ -152,14 +152,14 @@ bool MercurialClient::synchronousClone(const QString &workingDir,
// And last update repository // And last update repository
arguments.clear(); arguments.clear();
arguments << QLatin1String("update"); arguments << QLatin1String("update");
SynchronousProcess proc2; QtcProcess proc2;
vcsSynchronousExec(proc2, workingDirectory.path(), arguments, flags); vcsSynchronousExec(proc2, workingDirectory.path(), arguments, flags);
return proc2.result() == QtcProcess::FinishedWithSuccess; return proc2.result() == QtcProcess::FinishedWithSuccess;
} else { } else {
QStringList arguments(QLatin1String("clone")); QStringList arguments(QLatin1String("clone"));
arguments << dstLocation << workingDirectory.dirName(); arguments << dstLocation << workingDirectory.dirName();
workingDirectory.cdUp(); workingDirectory.cdUp();
SynchronousProcess proc; QtcProcess proc;
vcsSynchronousExec(proc, workingDirectory.path(), arguments, flags); vcsSynchronousExec(proc, workingDirectory.path(), arguments, flags);
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
} }
@@ -178,7 +178,7 @@ bool MercurialClient::synchronousPull(const QString &workingDir, const QString &
// cause mercurial doesn`t understand LANG // cause mercurial doesn`t understand LANG
Environment env = Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();
env.set("LANGUAGE", "C"); env.set("LANGUAGE", "C");
SynchronousProcess proc; QtcProcess proc;
proc.setTimeoutS(vcsTimeoutS()); proc.setTimeoutS(vcsTimeoutS());
VcsCommand command(workingDir, env); VcsCommand command(workingDir, env);
@@ -224,7 +224,7 @@ QStringList MercurialClient::parentRevisionsSync(const QString &workingDirectory
args << QLatin1String("parents") << QLatin1String("-r") <<revision; args << QLatin1String("parents") << QLatin1String("-r") <<revision;
if (!file.isEmpty()) if (!file.isEmpty())
args << file; args << file;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, args); vcsFullySynchronousExec(proc, workingDirectory, args);
if (proc.result() != QtcProcess::FinishedWithSuccess) if (proc.result() != QtcProcess::FinishedWithSuccess)
return QStringList(); return QStringList();
@@ -267,7 +267,7 @@ QString MercurialClient::shortDescriptionSync(const QString &workingDirectory,
if (!format.isEmpty()) if (!format.isEmpty())
args << QLatin1String("--template") << format; args << QLatin1String("--template") << format;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, args); vcsFullySynchronousExec(proc, workingDirectory, args);
if (proc.result() != QtcProcess::FinishedWithSuccess) if (proc.result() != QtcProcess::FinishedWithSuccess)
return revision; return revision;
@@ -287,7 +287,7 @@ bool MercurialClient::managesFile(const QString &workingDirectory, const QString
{ {
QStringList args; QStringList args;
args << QLatin1String("status") << QLatin1String("--unknown") << fileName; args << QLatin1String("status") << QLatin1String("--unknown") << fileName;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, args); vcsFullySynchronousExec(proc, workingDirectory, args);
return proc.stdOut().isEmpty(); return proc.stdOut().isEmpty();
} }

View File

@@ -1250,7 +1250,7 @@ PerforceResponse PerforcePluginPrivate::synchronousProcess(const QString &workin
QTC_ASSERT(stdInput.isEmpty(), return PerforceResponse()); // Not supported here QTC_ASSERT(stdInput.isEmpty(), return PerforceResponse()); // Not supported here
// Run, connect stderr to the output window // Run, connect stderr to the output window
SynchronousProcess process; QtcProcess process;
const int timeOutS = (flags & LongTimeOut) ? m_settings.longTimeOutS() : m_settings.timeOutS.value(); const int timeOutS = (flags & LongTimeOut) ? m_settings.longTimeOutS() : m_settings.timeOutS.value();
process.setTimeoutS(timeOutS); process.setTimeoutS(timeOutS);
if (outputCodec) if (outputCodec)

View File

@@ -83,7 +83,7 @@ static bool
const QMap<QString, QString> &fieldMap, const QMap<QString, QString> &fieldMap,
QString *stdOut /* = 0 */, QString *errorMessage) QString *stdOut /* = 0 */, QString *errorMessage)
{ {
Utils::SynchronousProcess process; Utils::QtcProcess process;
const QString binary = script.front(); const QString binary = script.front();
QStringList arguments; QStringList arguments;
const int binarySize = script.size(); const int binarySize = script.size();

View File

@@ -81,7 +81,7 @@ static QByteArray runGcc(const FilePath &gcc, const QStringList &arguments, cons
if (!gcc.isExecutableFile()) if (!gcc.isExecutableFile())
return QByteArray(); return QByteArray();
SynchronousProcess cpp; QtcProcess cpp;
Environment environment(env); Environment environment(env);
environment.setupEnglishOutput(); environment.setupEnglishOutput();

View File

@@ -237,7 +237,7 @@ static Utils::optional<VisualStudioInstallation> detectCppBuildTools2017()
static QVector<VisualStudioInstallation> detectVisualStudioFromVsWhere(const QString &vswhere) static QVector<VisualStudioInstallation> detectVisualStudioFromVsWhere(const QString &vswhere)
{ {
QVector<VisualStudioInstallation> installations; QVector<VisualStudioInstallation> installations;
SynchronousProcess vsWhereProcess; QtcProcess vsWhereProcess;
vsWhereProcess.setCodec(QTextCodec::codecForName("UTF-8")); vsWhereProcess.setCodec(QTextCodec::codecForName("UTF-8"));
const int timeoutS = 5; const int timeoutS = 5;
vsWhereProcess.setTimeoutS(timeoutS); vsWhereProcess.setTimeoutS(timeoutS);
@@ -615,7 +615,7 @@ Macros MsvcToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
qWarning("%s: %s", Q_FUNC_INFO, qPrintable(saver.errorString())); qWarning("%s: %s", Q_FUNC_INFO, qPrintable(saver.errorString()));
return predefinedMacros; return predefinedMacros;
} }
Utils::SynchronousProcess cpp; Utils::QtcProcess cpp;
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setWorkingDirectory(Utils::TemporaryDirectory::masterDirectoryPath()); cpp.setWorkingDirectory(Utils::TemporaryDirectory::masterDirectoryPath());
QStringList arguments; QStringList arguments;
@@ -1503,7 +1503,7 @@ static const MsvcToolChain *findMsvcToolChain(const QString &displayedVarsBat)
static QVersionNumber clangClVersion(const QString &clangClPath) static QVersionNumber clangClVersion(const QString &clangClPath)
{ {
SynchronousProcess clangClProcess; QtcProcess clangClProcess;
clangClProcess.setCommand({clangClPath, {"--version"}}); clangClProcess.setCommand({clangClPath, {"--version"}});
clangClProcess.runBlocking(); clangClProcess.runBlocking();
if (clangClProcess.result() != QtcProcess::FinishedWithSuccess) if (clangClProcess.result() != QtcProcess::FinishedWithSuccess)
@@ -1723,7 +1723,7 @@ Macros ClangClToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
if (!cxxflags.contains("--driver-mode=g++")) if (!cxxflags.contains("--driver-mode=g++"))
return MsvcToolChain::msvcPredefinedMacros(cxxflags, env); return MsvcToolChain::msvcPredefinedMacros(cxxflags, env);
SynchronousProcess cpp; QtcProcess cpp;
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setWorkingDirectory(Utils::TemporaryDirectory::masterDirectoryPath()); cpp.setWorkingDirectory(Utils::TemporaryDirectory::masterDirectoryPath());
@@ -2053,7 +2053,7 @@ Utils::optional<QString> MsvcToolChain::generateEnvironmentSettings(const Utils:
return QString(); return QString();
} }
Utils::SynchronousProcess run; Utils::QtcProcess run;
// As of WinSDK 7.1, there is logic preventing the path from being set // As of WinSDK 7.1, there is logic preventing the path from being set
// correctly if "ORIGINALPATH" is already set. That can cause problems // correctly if "ORIGINALPATH" is already set. That can cause problems

View File

@@ -278,7 +278,7 @@ Interpreter::Interpreter(const FilePath &python, const QString &defaultName, boo
: id(QUuid::createUuid().toString()) : id(QUuid::createUuid().toString())
, command(python) , command(python)
{ {
SynchronousProcess pythonProcess; QtcProcess pythonProcess;
pythonProcess.setProcessChannelMode(QProcess::MergedChannels); pythonProcess.setProcessChannelMode(QProcess::MergedChannels);
pythonProcess.setTimeoutS(1); pythonProcess.setTimeoutS(1);
pythonProcess.setCommand({python, {"--version"}}); pythonProcess.setCommand({python, {"--version"}});

View File

@@ -84,7 +84,7 @@ static QString pythonName(const FilePath &pythonPath)
return {}; return {};
QString name = nameForPython.value(pythonPath); QString name = nameForPython.value(pythonPath);
if (name.isEmpty()) { if (name.isEmpty()) {
SynchronousProcess pythonProcess; QtcProcess pythonProcess;
pythonProcess.setTimeoutS(2); pythonProcess.setTimeoutS(2);
pythonProcess.setCommand({pythonPath, {"--version"}}); pythonProcess.setCommand({pythonPath, {"--version"}});
pythonProcess.runBlocking(); pythonProcess.runBlocking();
@@ -107,7 +107,7 @@ FilePath getPylsModulePath(CommandLine pylsCommand)
pylsCommand.addArg("-h"); pylsCommand.addArg("-h");
SynchronousProcess pythonProcess; QtcProcess pythonProcess;
Environment env = pythonProcess.environment(); Environment env = pythonProcess.environment();
env.set("PYTHONVERBOSE", "x"); env.set("PYTHONVERBOSE", "x");
pythonProcess.setEnvironment(env); pythonProcess.setEnvironment(env);
@@ -161,7 +161,7 @@ static PythonLanguageServerState checkPythonLanguageServer(const FilePath &pytho
} }
} }
SynchronousProcess pythonProcess; QtcProcess pythonProcess;
pythonProcess.setCommand(pythonLShelpCommand); pythonProcess.setCommand(pythonLShelpCommand);
pythonProcess.runBlocking(); pythonProcess.runBlocking();
if (pythonProcess.allOutput().contains("Python Language Server")) if (pythonProcess.allOutput().contains("Python Language Server"))

View File

@@ -91,7 +91,7 @@ bool SubversionClient::doCommit(const QString &repositoryRoot,
<< QLatin1String("--file") << commitMessageFile; << QLatin1String("--file") << commitMessageFile;
QStringList args(vcsCommandString(CommitCommand)); QStringList args(vcsCommandString(CommitCommand));
SynchronousProcess proc; QtcProcess proc;
vcsSynchronousExec(proc, repositoryRoot, args << svnExtraOptions << escapeFiles(files), vcsSynchronousExec(proc, repositoryRoot, args << svnExtraOptions << escapeFiles(files),
VcsCommand::ShowStdOut | VcsCommand::NoFullySync); VcsCommand::ShowStdOut | VcsCommand::NoFullySync);
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
@@ -151,7 +151,7 @@ QString SubversionClient::synchronousTopic(const QString &repository) const
else else
svnVersionBinary = svnVersionBinary.left(pos + 1); svnVersionBinary = svnVersionBinary.left(pos + 1);
svnVersionBinary.append(HostOsInfo::withExecutableSuffix("svnversion")); svnVersionBinary.append(HostOsInfo::withExecutableSuffix("svnversion"));
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, repository, {svnVersionBinary, args}); vcsFullySynchronousExec(proc, repository, {svnVersionBinary, args});
if (proc.result() != QtcProcess::FinishedWithSuccess) if (proc.result() != QtcProcess::FinishedWithSuccess)
return QString(); return QString();

View File

@@ -1026,7 +1026,7 @@ SubversionResponse SubversionPluginPrivate::runSvn(const QString &workingDir,
return response; return response;
} }
SynchronousProcess proc; QtcProcess proc;
m_client->vcsFullySynchronousExec(proc, workingDir, arguments, flags, timeOutS, outputCodec); m_client->vcsFullySynchronousExec(proc, workingDir, arguments, flags, timeOutS, outputCodec);
response.error = proc.result() != QtcProcess::FinishedWithSuccess; response.error = proc.result() != QtcProcess::FinishedWithSuccess;

View File

@@ -88,7 +88,7 @@ static FormatTask format(FormatTask task)
// Format temporary file // Format temporary file
QStringList options = task.command.options(); QStringList options = task.command.options();
options.replaceInStrings(QLatin1String("%file"), sourceFile.filePath().toString()); options.replaceInStrings(QLatin1String("%file"), sourceFile.filePath().toString());
SynchronousProcess process; QtcProcess process;
process.setTimeoutS(5); process.setTimeoutS(5);
process.setCommand({executable, options}); process.setCommand({executable, options});
process.runBlocking(); process.runBlocking();

View File

@@ -72,7 +72,7 @@ QString findFallbackDefinitionsLocation()
// Try kde-config. // Try kde-config.
const QStringList programs = {"kde-config", "kde4-config"}; const QStringList programs = {"kde-config", "kde4-config"};
for (auto &program : programs) { for (auto &program : programs) {
Utils::SynchronousProcess process; Utils::QtcProcess process;
process.setTimeoutS(5); process.setTimeoutS(5);
process.setCommand({program, {"--prefix"}}); process.setCommand({program, {"--prefix"}});
process.runBlocking(); process.runBlocking();

View File

@@ -144,7 +144,7 @@ QString VcsBaseClientImpl::stripLastNewline(const QString &in)
return in; return in;
} }
void VcsBaseClientImpl::vcsFullySynchronousExec(SynchronousProcess &proc, void VcsBaseClientImpl::vcsFullySynchronousExec(QtcProcess &proc,
const QString &workingDir, const CommandLine &cmdLine, const QString &workingDir, const CommandLine &cmdLine,
unsigned flags, int timeoutS, QTextCodec *codec) const unsigned flags, int timeoutS, QTextCodec *codec) const
{ {
@@ -174,7 +174,7 @@ void VcsBaseClientImpl::annotateRevisionRequested(const QString &workingDirector
annotate(workingDirectory, file, changeCopy, line); annotate(workingDirectory, file, changeCopy, line);
} }
void VcsBaseClientImpl::vcsFullySynchronousExec(SynchronousProcess &proc, void VcsBaseClientImpl::vcsFullySynchronousExec(QtcProcess &proc,
const QString &workingDir, const QStringList &args, const QString &workingDir, const QStringList &args,
unsigned flags, int timeoutS, QTextCodec *codec) const unsigned flags, int timeoutS, QTextCodec *codec) const
{ {
@@ -195,7 +195,7 @@ VcsCommand *VcsBaseClientImpl::vcsExec(const QString &workingDirectory, const QS
return command; return command;
} }
void VcsBaseClientImpl::vcsSynchronousExec(SynchronousProcess &proc, const QString &workingDir, void VcsBaseClientImpl::vcsSynchronousExec(QtcProcess &proc, const QString &workingDir,
const QStringList &args, const QStringList &args,
unsigned flags, unsigned flags,
QTextCodec *outputCodec) const QTextCodec *outputCodec) const
@@ -259,7 +259,7 @@ bool VcsBaseClient::synchronousCreateRepository(const QString &workingDirectory,
{ {
QStringList args(vcsCommandString(CreateRepositoryCommand)); QStringList args(vcsCommandString(CreateRepositoryCommand));
args << extraOptions; args << extraOptions;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, args); vcsFullySynchronousExec(proc, workingDirectory, args);
if (proc.result() != QtcProcess::FinishedWithSuccess) if (proc.result() != QtcProcess::FinishedWithSuccess)
return false; return false;
@@ -279,7 +279,7 @@ bool VcsBaseClient::synchronousClone(const QString &workingDir,
args << vcsCommandString(CloneCommand) args << vcsCommandString(CloneCommand)
<< extraOptions << srcLocation << dstLocation; << extraOptions << srcLocation << dstLocation;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDir, args); vcsFullySynchronousExec(proc, workingDir, args);
resetCachedVcsInfo(workingDir); resetCachedVcsInfo(workingDir);
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
@@ -290,7 +290,7 @@ bool VcsBaseClient::synchronousAdd(const QString &workingDir, const QString &fil
{ {
QStringList args; QStringList args;
args << vcsCommandString(AddCommand) << extraOptions << filename; args << vcsCommandString(AddCommand) << extraOptions << filename;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDir, args); vcsFullySynchronousExec(proc, workingDir, args);
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
} }
@@ -300,7 +300,7 @@ bool VcsBaseClient::synchronousRemove(const QString &workingDir, const QString &
{ {
QStringList args; QStringList args;
args << vcsCommandString(RemoveCommand) << extraOptions << filename; args << vcsCommandString(RemoveCommand) << extraOptions << filename;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDir, args); vcsFullySynchronousExec(proc, workingDir, args);
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
} }
@@ -311,7 +311,7 @@ bool VcsBaseClient::synchronousMove(const QString &workingDir,
{ {
QStringList args; QStringList args;
args << vcsCommandString(MoveCommand) << extraOptions << from << to; args << vcsCommandString(MoveCommand) << extraOptions << from << to;
SynchronousProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDir, args); vcsFullySynchronousExec(proc, workingDir, args);
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
} }
@@ -327,7 +327,7 @@ bool VcsBaseClient::synchronousPull(const QString &workingDir,
VcsCommand::SshPasswordPrompt VcsCommand::SshPasswordPrompt
| VcsCommand::ShowStdOut | VcsCommand::ShowStdOut
| VcsCommand::ShowSuccessMessage; | VcsCommand::ShowSuccessMessage;
SynchronousProcess proc; QtcProcess proc;
vcsSynchronousExec(proc, workingDir, args, flags); vcsSynchronousExec(proc, workingDir, args, flags);
const bool ok = proc.result() == QtcProcess::FinishedWithSuccess; const bool ok = proc.result() == QtcProcess::FinishedWithSuccess;
if (ok) if (ok)
@@ -346,7 +346,7 @@ bool VcsBaseClient::synchronousPush(const QString &workingDir,
VcsCommand::SshPasswordPrompt VcsCommand::SshPasswordPrompt
| VcsCommand::ShowStdOut | VcsCommand::ShowStdOut
| VcsCommand::ShowSuccessMessage; | VcsCommand::ShowSuccessMessage;
SynchronousProcess proc; QtcProcess proc;
vcsSynchronousExec(proc, workingDir, args, flags); vcsSynchronousExec(proc, workingDir, args, flags);
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;
} }

View File

@@ -95,10 +95,10 @@ public:
static QString stripLastNewline(const QString &in); static QString stripLastNewline(const QString &in);
// Fully synchronous VCS execution (QProcess-based) // Fully synchronous VCS execution (QProcess-based)
void vcsFullySynchronousExec(Utils::SynchronousProcess &process, void vcsFullySynchronousExec(Utils::QtcProcess &process,
const QString &workingDir, const QStringList &args, const QString &workingDir, const QStringList &args,
unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const; unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const;
void vcsFullySynchronousExec(Utils::SynchronousProcess &process, void vcsFullySynchronousExec(Utils::QtcProcess &process,
const QString &workingDir, const Utils::CommandLine &cmdLine, const QString &workingDir, const Utils::CommandLine &cmdLine,
unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const; unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const;
@@ -115,7 +115,7 @@ protected:
// Synchronous VCS execution using Utils::SynchronousProcess, with // Synchronous VCS execution using Utils::SynchronousProcess, with
// log windows updating (using VcsBasePlugin::runVcs with flags) // log windows updating (using VcsBasePlugin::runVcs with flags)
void vcsSynchronousExec(Utils::SynchronousProcess &proc, void vcsSynchronousExec(Utils::QtcProcess &proc,
const QString &workingDir, const QString &workingDir,
const QStringList &args, const QStringList &args,
unsigned flags = 0, unsigned flags = 0,

View File

@@ -71,7 +71,7 @@ const Environment VcsCommand::processEnvironment() const
return env; return env;
} }
void VcsCommand::runCommand(SynchronousProcess &proc, void VcsCommand::runCommand(QtcProcess &proc,
const CommandLine &command, const CommandLine &command,
const QString &workingDirectory) const QString &workingDirectory)
{ {

View File

@@ -47,7 +47,7 @@ public:
const Utils::Environment processEnvironment() const override; const Utils::Environment processEnvironment() const override;
void runCommand(Utils::SynchronousProcess &process, void runCommand(Utils::QtcProcess &process,
const Utils::CommandLine &command, const Utils::CommandLine &command,
const QString &workDirectory = {}) override; const QString &workDirectory = {}) override;

View File

@@ -845,7 +845,7 @@ void tst_QtcProcess::exitCode()
QCOMPARE(qtcP.exitCode() == 0, qtcP.result() == QtcProcess::FinishedWithSuccess); QCOMPARE(qtcP.exitCode() == 0, qtcP.result() == QtcProcess::FinishedWithSuccess);
} }
{ {
SynchronousProcess sP; QtcProcess sP;
sP.setCommand(command); sP.setCommand(command);
sP.setEnvironment(env); sP.setEnvironment(env);
sP.runBlocking(); sP.runBlocking();
@@ -876,7 +876,7 @@ void tst_QtcProcess::runBlockingStdOut()
QFETCH(bool, withEndl); QFETCH(bool, withEndl);
QFETCH(int, timeOutS); QFETCH(int, timeOutS);
SynchronousProcess sp; QtcProcess sp;
QStringList args = QCoreApplication::arguments(); QStringList args = QCoreApplication::arguments();
const QString binary = args.takeFirst(); const QString binary = args.takeFirst();
sp.setCommand(CommandLine(binary, args)); sp.setCommand(CommandLine(binary, args));
@@ -893,7 +893,7 @@ void tst_QtcProcess::runBlockingStdOut()
}); });
sp.runBlocking(); sp.runBlocking();
// See also QTCREATORBUG-25667 for why it is a bad idea to use SynchronousProcess::runBlocking // See also QTCREATORBUG-25667 for why it is a bad idea to use QtcProcess::runBlocking
// with interactive cli tools. // with interactive cli tools.
QEXPECT_FAIL("Unterminated stdout lost: early timeout", "", Continue); QEXPECT_FAIL("Unterminated stdout lost: early timeout", "", Continue);
QVERIFY2(sp.result() != QtcProcess::Hang, "Process run did not time out."); QVERIFY2(sp.result() != QtcProcess::Hang, "Process run did not time out.");

View File

@@ -34,11 +34,11 @@
#include <cstdio> #include <cstdio>
static const char usage[] = static const char usage[] =
"Tests timeout behaviour of Utils:SynchronousProcess.\n" "Tests timeout behavior of Utils::QtcProcess.\n"
"Usage:\n" "Usage:\n"
" 1) Test Utils:SynchronousProcess (graphically)\n" " 1) Test Utils::QtcProcess (graphically)\n"
" process <cmd> <args>\n" " process <cmd> <args>\n"
" 2) Test synchronous helpers of Utils:SynchronousProcess (tty)\n" " 2) Test synchronous helpers of Utils::QtcProcess (tty)\n"
" process -s <cmd> <args>\n\n" " process -s <cmd> <args>\n\n"
"slowprocess.sh is provided as an example script that produces slow\n" "slowprocess.sh is provided as an example script that produces slow\n"
"output. It takes an option -e to switch to stderr\n" "output. It takes an option -e to switch to stderr\n"

View File

@@ -52,7 +52,7 @@ void MainWindow::test()
args.pop_front(); args.pop_front();
const QString cmd = args.front(); const QString cmd = args.front();
args.pop_front(); args.pop_front();
Utils::SynchronousProcess process; Utils::QtcProcess process;
process.setTimeoutS(2); process.setTimeoutS(2);
qDebug() << "Async: " << cmd << args; qDebug() << "Async: " << cmd << args;
process.setStdOutCallback([this](const QString &s) { append(s); }); process.setStdOutCallback([this](const QString &s) { append(s); });