From 391612fb2a5f8fc73bbf399ee7dc0c199c14fba5 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 28 Nov 2012 09:33:00 +0000 Subject: [PATCH] don't redirect to console if attach failed --- Common/OS.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/OS.cpp b/Common/OS.cpp index e04130fa3f..9fc0467854 100644 --- a/Common/OS.cpp +++ b/Common/OS.cpp @@ -259,7 +259,7 @@ void RedirectIOToConsole() // attaching to parent console, which allows to use the DOS shell to work // with Gmsh on the command line (without this hack, you need to either use // a better shell (e.g. bash), or compile a /subsystem:console version - AttachConsole(ATTACH_PARENT_PROCESS); + if(!AttachConsole(ATTACH_PARENT_PROCESS)) return; // redirect unbuffered stdout, stdin and stderr to the console intptr_t lStdHandle = (intptr_t)GetStdHandle(STD_OUTPUT_HANDLE); int hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); -- GitLab