From 5cbb3f33f8542cce5437f46f048bc732fbbee173 Mon Sep 17 00:00:00 2001 From: radius Date: Fri, 14 Oct 2016 00:57:15 -0500 Subject: [PATCH] use existing console if available --- frontend/drivers/platform_win32.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 9ed921f0b0..561f63860c 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -323,8 +323,11 @@ static uint64_t frontend_win32_get_mem_used(void) static void frontend_win32_attach_console(void) { #ifdef _WIN32 - AllocConsole(); - AttachConsole( GetCurrentProcessId()) ; + if (!AttachConsole(ATTACH_PARENT_PROCESS)) + { + AllocConsole(); + AttachConsole( GetCurrentProcessId()) ; + } freopen( "CON", "w", stdout ); freopen( "CON", "w", stderr ); #endif