"QProcess::startDetached" - child's console not showing up?
-
Is it really a normal thing that a child process that is a "console application" (SubSystem:CONSOLE) will not show up it's console when launched using "QProcess::startDetached"?
MS documentation regarding "AllocConsole" says:
"Console applications are initialized with a console, unless they are created as detached processes (by calling the CreateProcess function with the DETACHED_PROCESS flag)."
https://docs.microsoft.com/en-us/windows/console/allocconsoleI'm a bit confused, because I've tested this with two different Qt versions:
x86 - 5.7.0.0 - "QProcess::startDetached" - child process shows it's console.
x64 - 5.10.0.0 - "QProcess::startDetached" - child process will not show it's console.
(I'm migrating from 5.7 to 5.10 and was really surprised not to see the console)I'm suspecting that this was cause by the Qt bugfix: https://bugreports.qt.io/browse/QTBUG-53833
In my child process (debug) I've ended up with:
- Allways using "SubSystem:WINDOWS"
- Creating the console by using "AllocConsole()". (I'f you're using "SubSystem:CONSOLE" be sure to call "FreeConsole()" before calling "AllocConsole()")
- Capturing output with: "freopen("CONOUT$", "w", stderr);" and "freopen("CONOUT$", "w", stdout);"
-
Hi,
From the looks of it, you need to use the new version of startDetached using CreateProcessArgumentModifier.