(WIN32) don't reopen the stdout/stderr streams or close the console when

attaching an existing one.
This commit is contained in:
aliaspider 2016-11-17 20:16:50 +01:00
parent a1858d8f6b
commit 7d70fb3f4a

View File

@ -328,18 +328,21 @@ static void frontend_win32_attach_console(void)
{
AllocConsole();
AttachConsole( GetCurrentProcessId()) ;
freopen( "CON", "w", stdout );
freopen( "CON", "w", stderr );
}
freopen( "CON", "w", stdout );
freopen( "CON", "w", stderr );
#endif
}
static void frontend_win32_detach_console(void)
{
#if defined(_WIN32) && !defined(_XBOX)
HWND wnd = GetConsoleWindow();
FreeConsole();
PostMessage(wnd, WM_CLOSE, 0, 0);
if (!AttachConsole(ATTACH_PARENT_PROCESS))
{
HWND wnd = GetConsoleWindow();
FreeConsole();
PostMessage(wnd, WM_CLOSE, 0, 0);
}
#endif
}