summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2020-12-28 19:43:52 +0200
committerOswald Buddenhagen <oswald.buddenhagen@gmx.de>2020-12-31 12:16:38 +0000
commit04c34eb7992c88a84b04928985c231c44694ae8f (patch)
tree3906aa6b84a281787ac6ad081c92c69d8b2e3c05 /src/corelib/io/qprocess.cpp
parent1fb9c5348e3f7d4dd80e5b924aaca93632c651f9 (diff)
QProcess: allow merged channels forwarding for detached processes
[ChangeLog][QtCore][QProcess] Added support for QProcess::MergedChannels mode with startDetached(). Change-Id: I953ad2063322015332269522a297f8e2842e438c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/io/qprocess.cpp')
-rw-r--r--src/corelib/io/qprocess.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 9c6dafd7ef..bd25910976 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -616,7 +616,8 @@ void QProcessPrivate::Channel::clear()
process into the standard output channel (\c stdout). The
standard error channel (\c stderr) will not receive any data. The
standard output and standard error data of the running process
- are interleaved.
+ are interleaved. For detached processes, the merged output of the
+ running process is forwarded onto the main process.
\value ForwardedChannels QProcess forwards the output of the
running process onto the main process. Anything the child process
@@ -1000,10 +1001,11 @@ bool QProcessPrivate::openChannelsForDetached()
return false;
// stderr channel.
- if (processChannelMode == QProcess::MergedChannels || (stderrChannel.type != Channel::Normal
+ if (stderrChannel.type != Channel::Normal
&& (stderrChannel.type != Channel::Redirect
|| processChannelMode == QProcess::ForwardedChannels
- || processChannelMode == QProcess::ForwardedErrorChannel))) {
+ || processChannelMode == QProcess::ForwardedErrorChannel
+ || processChannelMode == QProcess::MergedChannels)) {
qWarning("QProcess::openChannelsForDetached: Inconsistent stderr channel configuration");
}
if (stderrChannel.type == Channel::Redirect && !openChannel(stderrChannel))
@@ -2172,6 +2174,7 @@ void QProcess::startCommand(const QString &command, OpenMode mode)
\li setStandardErrorFile()
\li setStandardInputFile()
\li setStandardOutputFile()
+ \li setProcessChannelMode(QProcess::MergedChannels)
\li setWorkingDirectory()
\endlist
All other properties of the QProcess object are ignored.