Utils::ShellCommand: Force fully synchronous execution from UI thread

Force runCommand when run from the UI thread to do fully synchronous
operations. This prevents two event loops in one thread with (sometimes)
interesting side effects.

This also stops signals from being sent while the process is running,
but the remaining users seem to be able to handle that.

Change-Id: Id5eb9868b660419987730c60e3fbfb4cbced1218
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2016-07-04 17:20:23 +02:00
parent 05b5b61673
commit b851b57ea3
2 changed files with 8 additions and 1 deletions

View File

@@ -140,6 +140,9 @@ public:
void setOutputProxyFactory(const std::function<OutputProxy *()> &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<void> &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,