forked from qt-creator/qt-creator
SynchronousProcess: Make runBlocking more robust
Make runBlocking handle the case where the process starts up too fast for waitForStarted. Change-Id: Id8f3522c7c23bc8d7cdbbc94da6fa6c0b8e45454 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -488,7 +488,8 @@ SynchronousProcessResponse SynchronousProcess::runBlocking(const QString &binary
|
||||
// event loop in that case.
|
||||
d->m_binary = binary;
|
||||
d->m_process.start(binary, args, QIODevice::ReadOnly);
|
||||
if (!d->m_process.waitForStarted(d->m_maxHangTimerCount * 1000)) {
|
||||
if (!d->m_process.waitForStarted(d->m_maxHangTimerCount * 1000)
|
||||
&& d->m_process.state() == QProcess::NotRunning) {
|
||||
d->m_result.result = SynchronousProcessResponse::StartFailed;
|
||||
return d->m_result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user