summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_win.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-09-03 16:17:14 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-05 21:17:18 +0200
commitdd9d6b3d5b21281707440db4413707e1d818889e (patch)
tree56155056eebe1b603d690f631f8338aa9e3bc9a9 /src/corelib/io/qprocess_win.cpp
parent4e5c2834a23be7a306e6de2680c3c560d8c02528 (diff)
make the pipe setup code less convoluted
Change-Id: Ied870c892cc3dbbf24a3d9416f685e51a74e5c17 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
Diffstat (limited to 'src/corelib/io/qprocess_win.cpp')
-rw-r--r--src/corelib/io/qprocess_win.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index cd5147c4a4..880cbf659d 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -155,28 +155,33 @@ bool QProcessPrivate::createChannel(Channel &channel)
if (channel.type == Channel::Normal) {
// we're piping this channel to our own process
- const bool isStdInChannel = (&channel == &stdinChannel);
- if (isStdInChannel || processChannelMode != QProcess::ForwardedChannels)
- qt_create_pipe(channel.pipe, isStdInChannel);
- else
- duplicateStdWriteChannel(channel.pipe, (&channel == &stdoutChannel) ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
-
- if (processChannelMode != QProcess::ForwardedChannels) {
+ if (&channel == &stdinChannel) {
+ qt_create_pipe(channel.pipe, true);
+ } else {
QWindowsPipeReader *pipeReader = 0;
if (&channel == &stdoutChannel) {
- if (!stdoutReader) {
- stdoutReader = new QWindowsPipeReader(q);
- q->connect(stdoutReader, SIGNAL(readyRead()), SLOT(_q_canReadStandardOutput()));
+ if (processChannelMode != QProcess::ForwardedChannels) {
+ if (!stdoutReader) {
+ stdoutReader = new QWindowsPipeReader(q);
+ q->connect(stdoutReader, SIGNAL(readyRead()), SLOT(_q_canReadStandardOutput()));
+ }
+ pipeReader = stdoutReader;
+ } else {
+ duplicateStdWriteChannel(channel.pipe, STD_OUTPUT_HANDLE);
}
- pipeReader = stdoutReader;
- } else if (&channel == &stderrChannel) {
- if (!stderrReader) {
- stderrReader = new QWindowsPipeReader(q);
- q->connect(stderrReader, SIGNAL(readyRead()), SLOT(_q_canReadStandardError()));
+ } else /* if (&channel == &stderrChannel) */ {
+ if (processChannelMode != QProcess::ForwardedChannels) {
+ if (!stderrReader) {
+ stderrReader = new QWindowsPipeReader(q);
+ q->connect(stderrReader, SIGNAL(readyRead()), SLOT(_q_canReadStandardError()));
+ }
+ pipeReader = stderrReader;
+ } else {
+ duplicateStdWriteChannel(channel.pipe, STD_ERROR_HANDLE);
}
- pipeReader = stderrReader;
}
if (pipeReader) {
+ qt_create_pipe(channel.pipe, false);
pipeReader->setHandle(channel.pipe[0]);
pipeReader->startAsyncRead();
}