diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-09-03 21:52:22 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-05 21:17:39 +0200 |
commit | fba0a307914772b286e8f315e0d1dec5ce7935f8 (patch) | |
tree | 10908de0f4da40445ff5db2072a7e7ccc532a0ef /src/corelib/io/qprocess_unix.cpp | |
parent | dd9d6b3d5b21281707440db4413707e1d818889e (diff) |
add QProcess::Forwarded{Output,Error}Channel
Change-Id: Ifc5ed20c38f3228ef25c28681f296d0456b61abe
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/io/qprocess_unix.cpp')
-rw-r--r-- | src/corelib/io/qprocess_unix.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index bc0ae5a382..0e0ead5897 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -813,6 +813,16 @@ pid_t QProcessPrivate::spawnChild(const char *workingDir, char **argv, char **en fd_map[1] = QT_FILENO(stdout); fd_map[2] = QT_FILENO(stderr); break; + case QProcess::ForwardedOutputChannel: + fd_map[0] = stdinChannel.pipe[0]; + fd_map[1] = QT_FILENO(stdout); + fd_map[2] = stderrChannel.pipe[1]; + break; + case QProcess::ForwardedErrorChannel: + fd_map[0] = stdinChannel.pipe[0]; + fd_map[1] = stdoutChannel.pipe[1]; + fd_map[2] = QT_FILENO(stderr); + break; case QProcess::MergedChannels: fd_map[0] = stdinChannel.pipe[0]; fd_map[1] = stdoutChannel.pipe[1]; @@ -850,12 +860,13 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv // copy the stdout and stderr if asked to if (processChannelMode != QProcess::ForwardedChannels) { - qt_safe_dup2(stdoutChannel.pipe[1], fileno(stdout), 0); + if (processChannelMode != QProcess::ForwardedOutputChannel) + qt_safe_dup2(stdoutChannel.pipe[1], fileno(stdout), 0); // merge stdout and stderr if asked to if (processChannelMode == QProcess::MergedChannels) { qt_safe_dup2(fileno(stdout), fileno(stderr), 0); - } else { + } else if (processChannelMode != QProcess::ForwardedErrorChannel) { qt_safe_dup2(stderrChannel.pipe[1], fileno(stderr), 0); } } |