diff --git a/src/libs/utils/shellcommand.cpp b/src/libs/utils/shellcommand.cpp index f95985492dd..49b6134a11c 100644 --- a/src/libs/utils/shellcommand.cpp +++ b/src/libs/utils/shellcommand.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include /*! @@ -326,7 +327,7 @@ Utils::SynchronousProcessResponse ShellCommand::runCommand(const Utils::FileName if (!(d->m_flags & SuppressCommandLogging)) proxy->appendCommand(dir, binary, arguments); - if (d->m_flags & FullySynchronously) + if (d->m_flags & FullySynchronously || QThread::currentThread() == QCoreApplication::instance()->thread()) response = runFullySynchronous(binary, arguments, proxy.data(), timeoutS, dir, interpreter); else response = runSynchronous(binary, arguments, proxy.data(), timeoutS, dir, interpreter); diff --git a/src/libs/utils/shellcommand.h b/src/libs/utils/shellcommand.h index 480865154b4..58527c4fe39 100644 --- a/src/libs/utils/shellcommand.h +++ b/src/libs/utils/shellcommand.h @@ -140,6 +140,9 @@ public: void setOutputProxyFactory(const std::function &factory); + // This is called once per job in a thread. + // When called from the UI thread it will execute fully synchronously, so no signals will + // be triggered! virtual SynchronousProcessResponse runCommand(const FileName &binary, const QStringList &arguments, int timeoutS, const QString &workingDirectory = QString(), @@ -162,10 +165,13 @@ protected: private: void run(QFutureInterface &future); + + // Run without a event loop in fully blocking mode. No signals will be delivered. SynchronousProcessResponse runFullySynchronous(const FileName &binary, const QStringList &arguments, OutputProxy *proxy, int timeoutS, const QString &workingDirectory, const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter); + // Run with an event loop. Signals will be delivered. SynchronousProcessResponse runSynchronous(const FileName &binary, const QStringList &arguments, OutputProxy *proxy, int timeoutS, const QString &workingDirectory,