QProcess/Unix: remove redundant checks in waitForReadyRead()

QProcessPrivate::tryReadFromChannel() returns 'true' only if we emitted
readyRead() signal on the current read channel. Thus, these additional
checks are unnecessary.

Change-Id: Id98620cd08ee8808f60539c009986b869e517ef0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This commit is contained in:
Alex Trotsenko 2020-11-26 17:37:13 +02:00
parent 97abbf3f1f
commit 6e07edb260

View File

@ -749,17 +749,14 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
return false;
}
// This calls QProcessPrivate::tryReadFromChannel(), which returns true
// if we emitted readyRead() signal on the current read channel.
bool readyReadEmitted = false;
if (qt_pollfd_check(poller.stdoutPipe(), POLLIN)) {
bool canRead = _q_canReadStandardOutput();
if (currentReadChannel == QProcess::StandardOutput && canRead)
readyReadEmitted = true;
}
if (qt_pollfd_check(poller.stderrPipe(), POLLIN)) {
bool canRead = _q_canReadStandardError();
if (currentReadChannel == QProcess::StandardError && canRead)
readyReadEmitted = true;
}
if (qt_pollfd_check(poller.stdoutPipe(), POLLIN) && _q_canReadStandardOutput())
readyReadEmitted = true;
if (qt_pollfd_check(poller.stderrPipe(), POLLIN) && _q_canReadStandardError())
readyReadEmitted = true;
if (readyReadEmitted)
return true;