summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_unix.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2015-07-22 10:56:06 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2016-01-29 09:14:44 +0000
commit7ff655360f1bebb657a7c035211058b340bf9f57 (patch)
tree08911a78216b58022c53aff4d232049e5a1dd803 /src/corelib/io/qprocess_unix.cpp
parent8f92baf5c946a93430e73adc79b4435060840777 (diff)
Integrate QProcess into QIODevice's multistreaming infrastructure
As a result, this patch eliminates double-buffering in QProcess. Change-Id: I436faa4a5ffc28ce77f959dd6089bef400ac39f6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib/io/qprocess_unix.cpp')
-rw-r--r--src/corelib/io/qprocess_unix.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index eeca8b48cf..40e393be9d 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -877,7 +877,7 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
if (stderrChannel.pipe[0] != -1)
add_fd(nfds, stderrChannel.pipe[0], &fdread);
- if (!stdinChannel.buffer.isEmpty() && stdinChannel.pipe[1] != -1)
+ if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
int timeout = qt_subtract_from_timeout(msecs, stopWatch.elapsed());
@@ -899,12 +899,12 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
bool readyReadEmitted = false;
if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread)) {
bool canRead = _q_canReadStandardOutput();
- if (processChannel == QProcess::StandardOutput && canRead)
+ if (currentReadChannel == QProcess::StandardOutput && canRead)
readyReadEmitted = true;
}
if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread)) {
bool canRead = _q_canReadStandardError();
- if (processChannel == QProcess::StandardError && canRead)
+ if (currentReadChannel == QProcess::StandardError && canRead)
readyReadEmitted = true;
}
if (readyReadEmitted)
@@ -930,7 +930,7 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
QElapsedTimer stopWatch;
stopWatch.start();
- while (!stdinChannel.buffer.isEmpty()) {
+ while (!writeBuffer.isEmpty()) {
fd_set fdread;
fd_set fdwrite;
@@ -949,7 +949,7 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
add_fd(nfds, stderrChannel.pipe[0], &fdread);
- if (!stdinChannel.buffer.isEmpty() && stdinChannel.pipe[1] != -1)
+ if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
int timeout = qt_subtract_from_timeout(msecs, stopWatch.elapsed());
@@ -1015,7 +1015,7 @@ bool QProcessPrivate::waitForFinished(int msecs)
if (processState == QProcess::Running && forkfd != -1)
add_fd(nfds, forkfd, &fdread);
- if (!stdinChannel.buffer.isEmpty() && stdinChannel.pipe[1] != -1)
+ if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
int timeout = qt_subtract_from_timeout(msecs, stopWatch.elapsed());