diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2015-08-13 18:59:03 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2015-08-16 14:22:32 +0000 |
commit | 6dde874c3203464f76170834234c026e02dc7abc (patch) | |
tree | 7befa97dfd373dfbbb71b61dbc3fc1d7873a8df1 /src/corelib/io/qprocess.cpp | |
parent | f029468b8d822da378a20577f7b8c16a447e4e1b (diff) |
QProcess: discard unwanted output from the child process
Drop process output to nullDevice(), if an application does not request
forwarding, redirecting or reading from the device channel. This
prevents from accumulation of unnecessary data which can not be read.
Change-Id: Ia311a8c658a46cf580ffa9484c5369f3fc5f98a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib/io/qprocess.cpp')
-rw-r--r-- | src/corelib/io/qprocess.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index dfde5f236d..cdae149678 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -2206,6 +2206,16 @@ void QProcessPrivate::start(QIODevice::OpenMode mode) mode &= ~QIODevice::ReadOnly; // not open for reading if (mode == 0) mode = QIODevice::Unbuffered; +#ifndef Q_OS_WINCE + if ((mode & QIODevice::ReadOnly) == 0) { + if (stdoutChannel.type == QProcessPrivate::Channel::Normal) + q->setStandardOutputFile(q->nullDevice()); + if (stderrChannel.type == QProcessPrivate::Channel::Normal + && processChannelMode != QProcess::MergedChannels) + q->setStandardErrorFile(q->nullDevice()); + } +#endif + q->QIODevice::open(mode); stdinChannel.closed = false; |