diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2021-01-15 19:39:08 +0200 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2021-01-22 16:26:39 +0200 |
commit | 3fc6b45cbb7b9bf3800be7c1f68b1484749489a3 (patch) | |
tree | 3db50e11933c6c5115e1c1001ca234bcdda0b4e0 /src/corelib/io/qprocess.cpp | |
parent | 5ea701337dc2a4e153a22e6e4aba1939f88714cf (diff) |
QProcess/Win: move pipe draining into QWindowsPipeReader
... where it belongs.
To avoid the loop, introduce the drainAndStop() function, which allows
QWindowsPipeReader to flush the pipe itself. It determines the number of
bytes pending and blocks until the remainder of the process output is
received.
Note that the loop in drainOutputPipes() didn't actually have to
interleave the two pipes (because we're presuming that the operations
will finish instantly), so we don't do it now. Also, the code violated
the API contract: 'true' was returned when the 'wrong' channel received
data; this is now fixed as a side effect.
Change-Id: I38ed4861a238e39e793c3716e856e5bfdeed3d74
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/io/qprocess.cpp')
-rw-r--r-- | src/corelib/io/qprocess.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 9170b72e56..05aa0f021f 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1142,9 +1142,10 @@ void QProcessPrivate::_q_processDied() // so the data is made available before we announce death. #ifdef Q_OS_WIN drainOutputPipes(); -#endif +#else _q_canReadStandardOutput(); _q_canReadStandardError(); +#endif // Slots connected to signals emitted by the functions called above // might call waitFor*(), which would synchronously reap the process. |