mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
On Windows attach to parent's console when no console is available
This gives a more Unix-like behavior when GC is launched from cmd or PowerShell, including --debug output, on release builds. Fixed #3481 [skip travis] [publish binaries]
This commit is contained in:
@@ -173,6 +173,16 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int ret=2; // return code from qapplication, default to error
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
// On Windows without console, we try to attach to the parent's console
|
||||
// and redirect stderr and stdout on success, to have a more Unix-like
|
||||
// behavior when launched from cmd or PowerShell.
|
||||
if (_fileno(stderr) == -2 && AttachConsole(ATTACH_PARENT_PROCESS )) {
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// PROCESS COMMAND LINE SWITCHES
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user