summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-08-03 01:00:16 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2018-08-07 17:44:51 +0200
commit053e7cce79d4bef99ec85101b0d22bbb171072c5 (patch)
treec2059e82cccdea1fd0024c5942d1a834c28d39da /src/corelib/io
parenta420d02538d28854914a6978c9637a0ddd652146 (diff)
parentf271dd8f960ad9f61697dfa57b26c4071441cadc (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: .qmake.conf src/corelib/doc/src/objectmodel/signalsandslots.qdoc src/plugins/platforms/cocoa/qcocoamenuloader.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp tests/auto/gui/image/qimage/tst_qimage.cpp Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I9bd24ee9b00d4f26c8f344ce3970aa6e93935ff5
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qprocess.cpp4
-rw-r--r--src/corelib/io/qprocess_unix.cpp12
-rw-r--r--src/corelib/io/qprocess_win.cpp14
3 files changed, 18 insertions, 12 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 2ee680a7c6..890867cd51 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -2147,6 +2147,10 @@ void QProcess::start(OpenMode mode)
\endlist
All other properties of the QProcess object are ignored.
+ \note The called process inherits the console window of the calling
+ process. To suppress console output, redirect standard/error output to
+ QProcess::nullDevice().
+
\sa start()
\sa startDetached(const QString &program, const QStringList &arguments,
const QString &workingDirectory, qint64 *pid)
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)
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 2e4b5d9cef..1f7a49379d 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -893,6 +893,11 @@ static bool startDetachedUacPrompt(const QString &programIn, const QStringList &
return true;
}
+static Q_PIPE pipeOrStdHandle(Q_PIPE pipe, DWORD handleNumber)
+{
+ return pipe != INVALID_Q_PIPE ? pipe : GetStdHandle(handleNumber);
+}
+
bool QProcessPrivate::startDetached(qint64 *pid)
{
static const DWORD errorElevationRequired = 740;
@@ -925,15 +930,14 @@ bool QProcessPrivate::startDetached(qint64 *pid)
0, 0, 0,
STARTF_USESTDHANDLES,
0, 0, 0,
- stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1]
+ pipeOrStdHandle(stdinChannel.pipe[0], STD_INPUT_HANDLE),
+ pipeOrStdHandle(stdoutChannel.pipe[1], STD_OUTPUT_HANDLE),
+ pipeOrStdHandle(stderrChannel.pipe[1], STD_ERROR_HANDLE)
};
- const bool inheritHandles = stdinChannel.type == Channel::Redirect
- || stdoutChannel.type == Channel::Redirect
- || stderrChannel.type == Channel::Redirect;
QProcess::CreateProcessArguments cpargs = {
nullptr, reinterpret_cast<wchar_t *>(const_cast<ushort *>(args.utf16())),
- nullptr, nullptr, inheritHandles, dwCreationFlags, envPtr,
+ nullptr, nullptr, true, dwCreationFlags, envPtr,
workingDirectory.isEmpty()
? nullptr : reinterpret_cast<const wchar_t *>(workingDirectory.utf16()),
&startupInfo, &pinfo