From dccc2aff6cb0bc480c6272536f595936e4ebc31d Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Tue, 8 Dec 2020 20:42:34 +0200 Subject: QProcess/Unix: unify waiting in 'Starting' state It makes no sense to poll the I/O pipes if we didn't get a start-up notification yet. And in fact, all waitFor...() functions except waitForReadyRead() did already explicitly wait for process startup completion. So fix that one up, and remove the handling of 'Starting' state from the I/O loops. Change-Id: Ibb7eb7c768bef3f9b6c54009c73b91775570102c Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/corelib/io/qprocess.cpp') diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 1583f31e34..fb769ef74c 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1783,7 +1783,15 @@ bool QProcess::waitForReadyRead(int msecs) return false; if (d->currentReadChannel == QProcess::StandardError && d->stderrChannel.closed) return false; - return d->waitForReadyRead(QDeadlineTimer(msecs)); + + QDeadlineTimer deadline(msecs); + if (d->processState == QProcess::Starting) { + bool started = d->waitForStarted(deadline); + if (!started) + return false; + } + + return d->waitForReadyRead(deadline); } /*! \reimp -- cgit v1.2.3