diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2018-07-23 08:25:56 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2018-08-01 07:19:53 +0000 |
commit | bd7eb131782286d5b41fb1a5b9de0350b4968e3b (patch) | |
tree | 4ee10c9eef832392bdc186f552047b6d23f11045 /src/corelib/io/qprocess_unix.cpp | |
parent | d3cbabcc6dd1c0162e01214b25631332566354bd (diff) |
Fix conditions for dup2 in QProcess::startDetached
The channel pipes are only set up if the channel's type is
Redirect. Fix the conditions accordingly.
This amends commit 7ad55ca6.
Change-Id: Ie8a800fbe2bf9f5f6709b14ba03133b80e9b4bef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/corelib/io/qprocess_unix.cpp')
-rw-r--r-- | src/corelib/io/qprocess_unix.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index a849519635..713af9bd40 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -949,16 +949,14 @@ bool QProcessPrivate::startDetached(qint64 *pid) qt_safe_close(pidPipe[1]); // copy the stdin socket if asked to (without closing on exec) - if (inputChannelMode != QProcess::ForwardedInputChannel) + if (stdinChannel.type == Channel::Redirect) qt_safe_dup2(stdinChannel.pipe[0], STDIN_FILENO, 0); // copy the stdout and stderr if asked to - if (processChannelMode != QProcess::ForwardedChannels) { - if (processChannelMode != QProcess::ForwardedOutputChannel) - qt_safe_dup2(stdoutChannel.pipe[1], STDOUT_FILENO, 0); - if (processChannelMode != QProcess::ForwardedErrorChannel) - qt_safe_dup2(stderrChannel.pipe[1], STDERR_FILENO, 0); - } + if (stdoutChannel.type == Channel::Redirect) + qt_safe_dup2(stdoutChannel.pipe[1], STDOUT_FILENO, 0); + if (stderrChannel.type == Channel::Redirect) + qt_safe_dup2(stderrChannel.pipe[1], STDERR_FILENO, 0); if (!encodedWorkingDirectory.isEmpty()) { if (QT_CHDIR(encodedWorkingDirectory.constData()) == -1) |