From 45af51ad3787b161b103de0ea1b68cfe3a19337d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo?= Date: Wed, 9 Jul 2025 03:08:00 -0300 Subject: [PATCH] Add command-line option to show console output on Windows. (#632) --- src/main/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/main.cpp b/src/main/main.cpp index cef8db2..c25c182 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -579,6 +579,22 @@ int main(int argc, char** argv) { } #ifdef _WIN32 + for (int i = 1; i < argc; i++) + { + if (strcmp(argv[i], "--show-console") == 0) + { + if (GetConsoleWindow() == nullptr) + { + AllocConsole(); + freopen("CONIN$", "r", stdin); + freopen("CONOUT$", "w", stderr); + freopen("CONOUT$", "w", stdout); + } + + break; + } + } + // Set up console output to accept UTF-8 on windows SetConsoleOutputCP(CP_UTF8);