diff --git a/src/libs/utils/shellcommand.cpp b/src/libs/utils/shellcommand.cpp index b88f8a0b960..2e8d9b8098c 100644 --- a/src/libs/utils/shellcommand.cpp +++ b/src/libs/utils/shellcommand.cpp @@ -274,8 +274,9 @@ void ShellCommand::run(QFutureInterface &future) for (int j = 0; j < count; j++) { const Internal::ShellCommandPrivate::Job &job = d->m_jobs.at(j); SynchronousProcess proc; - runCommand(proc, job.command, job.timeoutS, job.workingDirectory, - job.exitCodeInterpreter); + proc.setExitCodeInterpreter(job.exitCodeInterpreter); + proc.setTimeoutS(job.timeoutS); + runCommand(proc, job.command, job.workingDirectory); stdOut += proc.stdOut(); stdErr += proc.stdErr(); d->m_lastExecExitCode = proc.exitCode(); @@ -307,9 +308,8 @@ void ShellCommand::run(QFutureInterface &future) } void ShellCommand::runCommand(SynchronousProcess &proc, - const CommandLine &command, int timeoutS, - const QString &workingDirectory, - const ExitCodeInterpreter &interpreter) + const CommandLine &command, + const QString &workingDirectory) { const QString dir = workDirectory(workingDirectory); @@ -323,9 +323,6 @@ void ShellCommand::runCommand(SynchronousProcess &proc, if (!(d->m_flags & SuppressCommandLogging)) emit proxy->appendCommand(dir, command); - proc.setTimeoutS(timeoutS); - proc.setExitCodeInterpreter(interpreter); - if ((d->m_flags & FullySynchronously) || (!(d->m_flags & NoFullySync) && QThread::currentThread() == QCoreApplication::instance()->thread())) { diff --git a/src/libs/utils/shellcommand.h b/src/libs/utils/shellcommand.h index d803969bd28..f2a264293ed 100644 --- a/src/libs/utils/shellcommand.h +++ b/src/libs/utils/shellcommand.h @@ -144,9 +144,7 @@ public: // be triggered! virtual void runCommand(Utils::SynchronousProcess &process, const CommandLine &command, - int timeoutS, - const QString &workingDirectory = QString(), - const ExitCodeInterpreter &interpreter = {}); + const QString &workingDirectory = QString()); void cancel(); diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp index 63f7e1e54c5..65bb5b8760b 100644 --- a/src/plugins/clearcase/clearcaseplugin.cpp +++ b/src/plugins/clearcase/clearcaseplugin.cpp @@ -1668,11 +1668,12 @@ ClearCasePluginPrivate::runCleartool(const QString &workingDir, } SynchronousProcess proc; + proc.setTimeoutS(timeOutS); VcsCommand command(workingDir, Environment::systemEnvironment()); command.addFlags(flags); command.setCodec(outputCodec); - command.runCommand(proc, {executable, arguments}, timeOutS); + command.runCommand(proc, {executable, arguments}); response.error = proc.result() != QtcProcess::Finished; if (response.error) diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 5e3aa2252dd..cb251c7b9d3 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -1447,11 +1447,12 @@ CvsResponse CvsPluginPrivate::runCvs(const QString &workingDirectory, } // Run, connect stderr to the output window SynchronousProcess proc; + proc.setTimeoutS(timeOutS); VcsCommand command(workingDirectory, Environment::systemEnvironment()); command.addFlags(flags); command.setCodec(outputCodec); - command.runCommand(proc, {executable, m_settings.addOptions(arguments)}, timeOutS); + command.runCommand(proc, {executable, m_settings.addOptions(arguments)}); response.result = CvsResponse::OtherError; response.stdErr = proc.stdErr(); diff --git a/src/plugins/git/gitgrep.cpp b/src/plugins/git/gitgrep.cpp index c6094ca8e8b..ed78a18459d 100644 --- a/src/plugins/git/gitgrep.cpp +++ b/src/plugins/git/gitgrep.cpp @@ -195,7 +195,8 @@ public: watcher.setFuture(m_fi.future()); connect(command.data(), &VcsCommand::stdOutText, this, &GitGrepRunner::read); SynchronousProcess proc; - command->runCommand(proc, {GitClient::instance()->vcsBinary(), arguments}, 0); + proc.setTimeoutS(0); + command->runCommand(proc, {GitClient::instance()->vcsBinary(), arguments}); switch (proc.result()) { case QtcProcess::TerminatedAbnormally: case QtcProcess::StartFailed: diff --git a/src/plugins/mercurial/mercurialclient.cpp b/src/plugins/mercurial/mercurialclient.cpp index a90a40d3af9..f887b790ac1 100644 --- a/src/plugins/mercurial/mercurialclient.cpp +++ b/src/plugins/mercurial/mercurialclient.cpp @@ -179,10 +179,11 @@ bool MercurialClient::synchronousPull(const QString &workingDir, const QString & Environment env = Environment::systemEnvironment(); env.set("LANGUAGE", "C"); SynchronousProcess proc; + proc.setTimeoutS(vcsTimeoutS()); VcsCommand command(workingDir, env); command.addFlags(flags); - command.runCommand(proc, {vcsBinary(), args}, vcsTimeoutS()); + command.runCommand(proc, {vcsBinary(), args}); const bool ok = proc.result() == QtcProcess::Finished; diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 6a33068fb0b..26acb2161cc 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -162,7 +162,8 @@ void VcsBaseClientImpl::vcsFullySynchronousExec(SynchronousProcess &proc, command.addFlags(flags); if (codec) command.setCodec(codec); - command.runCommand(proc, cmdLine, (timeoutS > 0) ? timeoutS : vcsTimeoutS()); + proc.setTimeoutS(timeoutS > 0 ? timeoutS : vcsTimeoutS()); + command.runCommand(proc, cmdLine); } void VcsBaseClientImpl::resetCachedVcsInfo(const QString &workingDir) @@ -211,9 +212,10 @@ void VcsBaseClientImpl::vcsSynchronousExec(SynchronousProcess &proc, const QStri { Environment env = processEnvironment(); VcsCommand command(workingDir, env.size() == 0 ? Environment::systemEnvironment() : env); + proc.setTimeoutS(vcsTimeoutS()); command.addFlags(flags); command.setCodec(outputCodec); - command.runCommand(proc, {vcsBinary(), args}, vcsTimeoutS()); + command.runCommand(proc, {vcsBinary(), args}); } int VcsBaseClientImpl::vcsTimeoutS() const diff --git a/src/plugins/vcsbase/vcscommand.cpp b/src/plugins/vcsbase/vcscommand.cpp index 0656ed52453..deb12aecc13 100644 --- a/src/plugins/vcsbase/vcscommand.cpp +++ b/src/plugins/vcsbase/vcscommand.cpp @@ -78,11 +78,9 @@ const Environment VcsCommand::processEnvironment() const void VcsCommand::runCommand(SynchronousProcess &proc, const CommandLine &command, - int timeoutS, - const QString &workingDirectory, - const ExitCodeInterpreter &interpreter) + const QString &workingDirectory) { - ShellCommand::runCommand(proc, command, timeoutS, workingDirectory, interpreter); + ShellCommand::runCommand(proc, command, workingDirectory); emitRepositoryChanged(workingDirectory); } diff --git a/src/plugins/vcsbase/vcscommand.h b/src/plugins/vcsbase/vcscommand.h index 71263ede83b..37fc6f23b3a 100644 --- a/src/plugins/vcsbase/vcscommand.h +++ b/src/plugins/vcsbase/vcscommand.h @@ -47,9 +47,7 @@ public: void runCommand(Utils::SynchronousProcess &process, const Utils::CommandLine &command, - int timeoutS, - const QString &workDirectory = QString(), - const Utils::ExitCodeInterpreter &interpreter = {}) override; + const QString &workDirectory = {}) override; private: void emitRepositoryChanged(const QString &workingDirectory);