fix infinite loop in QProcessPrivate::drainOutputPipes

When drainOutputPipes is called, the process is already dead.
If readyReadEmitted is false, there was no data in the pipes.
As the process is dead, there won't be data in the pipes in future
iterations.

The situation that triggered the infinite loop was this:
process A starts console process B.
B starts console process C. C inherits stdout/err of B.
B dies. C runs forever and does not close the stdout/err handles.
A notices that B died and calls drainOutputPipes.

Task-number: QTBUG-29391

Change-Id: I4819901df307be684c6ad70753a5f964a834704a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Joerg Bornemann 2013-07-03 16:10:31 +02:00 committed by The Qt Project
parent ee73f7b7db
commit 568f82fba3

View File

@ -641,7 +641,7 @@ bool QProcessPrivate::drainOutputPipes()
readyReadEmitted |= stderrReader->waitForReadyRead(0);
readOperationActive |= stderrReader->isReadOperationActive();
}
if (!readOperationActive)
if (!readOperationActive || !readyReadEmitted)
break;
Sleep(100);
}