diff options
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qprocess.cpp | 10 | ||||
-rw-r--r-- | src/corelib/io/qprocess_unix.cpp | 23 |
2 files changed, 11 insertions, 22 deletions
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 diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 636f6f2e22..bb52233a9c 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -157,9 +157,8 @@ struct QProcessPoller pollfd &stdoutPipe() { return pfds[1]; } pollfd &stderrPipe() { return pfds[2]; } pollfd &forkfd() { return pfds[3]; } - pollfd &childStartedPipe() { return pfds[4]; } - enum { n_pfds = 5 }; + enum { n_pfds = 4 }; pollfd pfds[n_pfds]; }; @@ -177,15 +176,11 @@ QProcessPoller::QProcessPoller(const QProcessPrivate &proc) } forkfd().fd = proc.forkfd; - - if (proc.processState == QProcess::Starting) - childStartedPipe().fd = proc.childStartedPipe[0]; } int QProcessPoller::poll(const QDeadlineTimer &deadline) { - const nfds_t nfds = (childStartedPipe().fd == -1) ? 4 : 5; - return qt_poll_msecs(pfds, nfds, deadline.remainingTime()); + return qt_poll_msecs(pfds, n_pfds, deadline.remainingTime()); } } // anonymous namespace @@ -740,11 +735,6 @@ bool QProcessPrivate::waitForReadyRead(const QDeadlineTimer &deadline) return false; } - if (qt_pollfd_check(poller.childStartedPipe(), POLLIN)) { - if (!_q_startupNotification()) - return false; - } - // This calls QProcessPrivate::tryReadFromChannel(), which returns true // if we emitted readyRead() signal on the current read channel. bool readyReadEmitted = false; @@ -791,11 +781,6 @@ bool QProcessPrivate::waitForBytesWritten(const QDeadlineTimer &deadline) return false; } - if (qt_pollfd_check(poller.childStartedPipe(), POLLIN)) { - if (!_q_startupNotification()) - return false; - } - if (qt_pollfd_check(poller.stdinPipe(), POLLOUT)) return _q_canWrite(); @@ -837,10 +822,6 @@ bool QProcessPrivate::waitForFinished(const QDeadlineTimer &deadline) return false; } - if (qt_pollfd_check(poller.childStartedPipe(), POLLIN)) { - if (!_q_startupNotification()) - return false; - } if (qt_pollfd_check(poller.stdinPipe(), POLLOUT)) _q_canWrite(); |