fix waiting in SynchronousProcess::runBlocking()

the conditions on the waitForFinished() calls were inverted. the visible
effect of this was that 'Hang' was never reported.

Change-Id: I9937fce58189eebf891000840597158b4bffd028
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Oswald Buddenhagen
2020-12-09 18:52:45 +01:00
parent ef3821c6b9
commit 65fb83089e

View File

@@ -537,11 +537,11 @@ SynchronousProcessResponse SynchronousProcess::runBlocking(const CommandLine &cm
return d->m_result; return d->m_result;
} }
d->m_process.closeWriteChannel(); d->m_process.closeWriteChannel();
if (d->m_process.waitForFinished(d->m_maxHangTimerCount * 1000)) { if (!d->m_process.waitForFinished(d->m_maxHangTimerCount * 1000)) {
if (d->m_process.state() == QProcess::Running) { if (d->m_process.state() == QProcess::Running) {
d->m_result.result = SynchronousProcessResponse::Hang; d->m_result.result = SynchronousProcessResponse::Hang;
d->m_process.terminate(); d->m_process.terminate();
if (d->m_process.waitForFinished(1000) && d->m_process.state() == QProcess::Running) { if (!d->m_process.waitForFinished(1000) && d->m_process.state() == QProcess::Running) {
d->m_process.kill(); d->m_process.kill();
d->m_process.waitForFinished(1000); d->m_process.waitForFinished(1000);
} }