Prevent infinite loop when user chooses not to terminate hanged process

Happens if the process is already terminated

Change-Id: I660779dc701d1fe8b41562f68f0ce95c6e87058f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Orgad Shaneh
2013-02-20 16:42:51 +02:00
committed by Orgad Shaneh
parent 40a1b4afb7
commit 9dd3a14f28

View File

@@ -560,7 +560,7 @@ bool SynchronousProcess::readDataFromProcess(QProcess &p, int timeOutMS,
bool finished = false;
bool hasData = false;
do {
finished = p.waitForFinished(timeOutMS);
finished = p.state() == QProcess::NotRunning || p.waitForFinished(timeOutMS);
hasData = false;
// First check 'stdout'
if (p.bytesAvailable()) { // applies to readChannel() only