"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)."
I'm a bit confused, because I've tested this with two different Qt versions:
x86 - 220.127.116.11 - "QProcess::startDetached" - child process shows it's console.
x64 - 18.104.22.168 - "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);"