From 3e3fffff65dd64c1224110d02fb225889fc73564 Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Sat, 8 Nov 2025 13:53:41 -0300 Subject: [PATCH] app-tools: Port fixes from 89132717 and c79bf579 to gimp-debug-tool --- app-tools/gimp-debug-tool.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app-tools/gimp-debug-tool.c b/app-tools/gimp-debug-tool.c index 61bfe42828..cc672ad08b 100644 --- a/app-tools/gimp-debug-tool.c +++ b/app-tools/gimp-debug-tool.c @@ -64,9 +64,16 @@ main (int argc, #ifdef G_OS_WIN32 if (AttachConsole (ATTACH_PARENT_PROCESS) != 0 && ! g_getenv ("TERM") && ! g_getenv ("SHELL")) { - freopen ("CONOUT$", "w", stdout); - freopen ("CONOUT$", "w", stderr); + /* 'r' is needed to prevent interleaving and '+' to support colors */ + freopen ("CONOUT$", "r+", stdout); + freopen ("CONOUT$", "r+", stderr); _flushall (); + + { + /* CTRL+C handling */ + HANDLE hIn = GetStdHandle (STD_INPUT_HANDLE); + SetConsoleMode (hIn, ENABLE_PROCESSED_INPUT); + } } #endif