|
|
|
@@ -261,9 +261,13 @@ bool JUCEApplicationBase::initialiseApp() |
|
|
|
if (AttachConsole (ATTACH_PARENT_PROCESS) != 0)
|
|
|
|
{
|
|
|
|
// if we've launched a GUI app from cmd.exe or PowerShell, we need this to enable printf etc.
|
|
|
|
freopen("CON", "w", stdout);
|
|
|
|
freopen("CON", "w", stderr);
|
|
|
|
freopen("CON", "r", stdin);
|
|
|
|
// However, only reassign stdout, stderr, stdin if they have not been already opened by
|
|
|
|
// a redirect or similar.
|
|
|
|
FILE* ignore;
|
|
|
|
|
|
|
|
if (_fileno(stdout) < 0) freopen_s (&ignore, "CONOUT$", "w", stdout);
|
|
|
|
if (_fileno(stderr) < 0) freopen_s (&ignore, "CONOUT$", "w", stderr);
|
|
|
|
if (_fileno(stdin) < 0) freopen_s (&ignore, "CONIN$", "r", stdin);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|