From 74955555b938088b5294991a8ba16350a36feafe Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 11 Dec 2018 23:52:18 +0100 Subject: [PATCH] remove verbose comments and example --- components/debug/debugging.cpp | 1 - components/debug/win32.cpp | 19 +------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/components/debug/debugging.cpp b/components/debug/debugging.cpp index 9798950b9f..caef1e1dc3 100644 --- a/components/debug/debugging.cpp +++ b/components/debug/debugging.cpp @@ -53,7 +53,6 @@ namespace Debug int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, char *argv[], const std::string& appName) { #if defined _WIN32 - // grab a console window if we don't have one (void)Debug::attachParentConsole(); #endif diff --git a/components/debug/win32.cpp b/components/debug/win32.cpp index 1d5657d253..16a264a0bc 100644 --- a/components/debug/win32.cpp +++ b/components/debug/win32.cpp @@ -14,21 +14,17 @@ namespace Debug { bool attachParentConsole() { - // we already have a console window if (GetConsoleWindow() != nullptr) return true; - // our parent window has a console we can use if (AttachConsole(ATTACH_PARENT_PROCESS)) { - // start with consistent state fflush(stdout); fflush(stderr); std::cout.flush(); std::cerr.flush(); - // fix fprintf(3) and fwprintf(3) - // this looks strange, but nothing is ever simple on Windows. + // this looks dubious but is really the right way _wfreopen(L"CON", L"w", stdout); _wfreopen(L"CON", L"w", stderr); _wfreopen(L"CON", L"r", stdin); @@ -36,19 +32,6 @@ bool attachParentConsole() freopen("CON", "w", stderr); freopen("CON", "r", stdin); - // it can be verified that input/output works as expected. -#if 0 - fprintf(stdout, "ascii stdout\n"); - fwprintf(stdout, L"wide stdout\n"); - fprintf(stderr, "ascii stderr\n"); - fwprintf(stderr, L"wide stderr\n"); - - std::cout << "ascii cout\n"; - std::cout << L"wide cout\n"; - std::cerr << "ascii cerr\n"; - std::cerr << L"wide cerr\n"; -#endif - return true; }