forked from qt-creator/qt-creator
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:
@@ -39,6 +39,7 @@
|
||||
#include <QSharedPointer>
|
||||
#include <QStringList>
|
||||
#include <QTextCodec>
|
||||
#include <QThread>
|
||||
#include <QVariant>
|
||||
|
||||
/*!
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user