fix endless loop in QProcess/Win drainOutputPipes
Commit 568f82fba3 was incomplete.
If drainOutputPipes detected some readyRead it wouldn't end the loop.
Task-number: QTBUG-32354
Change-Id: I4e594f1e148abe9ef36c047a55eee1b22fd5064b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
bb10
parent
81addcc1ed
commit
5d6dbc6637
|
|
@ -630,8 +630,9 @@ bool QProcessPrivate::drainOutputPipes()
|
|||
if (!stdoutReader && !stderrReader)
|
||||
return false;
|
||||
|
||||
bool readyReadEmitted = false;
|
||||
bool someReadyReadEmitted = false;
|
||||
forever {
|
||||
bool readyReadEmitted = false;
|
||||
bool readOperationActive = false;
|
||||
if (stdoutReader) {
|
||||
readyReadEmitted |= stdoutReader->waitForReadyRead(0);
|
||||
|
|
@ -641,12 +642,13 @@ bool QProcessPrivate::drainOutputPipes()
|
|||
readyReadEmitted |= stderrReader->waitForReadyRead(0);
|
||||
readOperationActive |= stderrReader->isReadOperationActive();
|
||||
}
|
||||
someReadyReadEmitted |= readyReadEmitted;
|
||||
if (!readOperationActive || !readyReadEmitted)
|
||||
break;
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
return readyReadEmitted;
|
||||
return someReadyReadEmitted;
|
||||
}
|
||||
|
||||
bool QProcessPrivate::waitForReadyRead(int msecs)
|
||||
|
|
|
|||
Loading…
Reference in New Issue