diff options
author | Kevin Funk <kevin.funk@kdab.com> | 2016-06-14 22:46:08 +0200 |
---|---|---|
committer | Kevin Funk <kevin.funk@kdab.com> | 2016-07-06 07:00:13 +0000 |
commit | bec2fc19fd18768b16925597871c77a61e716abd (patch) | |
tree | 2dd49029cca723a623d212d7be1c4ae047612b97 | |
parent | 9e49778380c056b1ce7f30dbd774c545bff030c5 (diff) |
Windows/QProcess::startDetached(): Don't always create console
Make QProcess::startDetached() behave exactly like QProcess::start() when it
comes to the behavior of whether to create a new console window or not.
Before this patch, QProcess::startDetached() created a new console window
(CREATE_NEW_CONSOLE flag of CreateProcess()) unconditionally. Instead, use the
same rules for deducing whether to show an console window or not as
QProcess::start().
[ChangeLog][QtCore][Platform Specific Changes] QProcess::startDetached()
changed behavior on Windows: it no longer creates a new console window
unconditionally, instead it passes the same creation flags to CreateProcess
as QProcess::start().
Task-number: QTBUG-53833
Change-Id: I0e3d4b161fb5cb94cfbbd21fb4edb8417ab543fd
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/corelib/io/qprocess_win.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 96b39efe3a..8579db1694 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -867,13 +867,15 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a bool success = false; PROCESS_INFORMATION pinfo; + DWORD dwCreationFlags = (GetConsoleWindow() ? 0 : CREATE_NO_WINDOW); + dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT; STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; success = CreateProcess(0, (wchar_t*)args.utf16(), - 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0, + 0, 0, FALSE, dwCreationFlags, 0, workingDir.isEmpty() ? 0 : (wchar_t*)workingDir.utf16(), &startupInfo, &pinfo); |