From 0da81b301833a87dde90a620daa397908a2bbbdc Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 21 Nov 2007 14:47:15 -0600 Subject: [PATCH] Reuse existing console if present, or else open a new console, when -console is supplied --- vm/os-windows-nt.c | 10 ++++++++++ vm/os-windows-nt.h | 1 + 2 files changed, 11 insertions(+) diff --git a/vm/os-windows-nt.c b/vm/os-windows-nt.c index 7ea8155072..afd1e0ed3b 100755 --- a/vm/os-windows-nt.c +++ b/vm/os-windows-nt.c @@ -91,4 +91,14 @@ void c_to_factor_toplevel(CELL quot) void open_console(void) { + if(!console_open) + { + if(!AttachConsole(ATTACH_PARENT_PROCESS)) + { + if(AllocConsole()) + console_open = true; + } + else + console_open = true; + } } diff --git a/vm/os-windows-nt.h b/vm/os-windows-nt.h index f74c7b1883..9e451f0301 100755 --- a/vm/os-windows-nt.h +++ b/vm/os-windows-nt.h @@ -18,4 +18,5 @@ typedef char F_SYMBOL; void c_to_factor_toplevel(CELL quot); long exception_handler(PEXCEPTION_POINTERS pe); +bool console_open; void open_console(void);