app-tools: Port fixes from 89132717 and c79bf579 to gimp-debug-tool

This commit is contained in:
Bruno Lopes 2025-11-08 13:53:41 -03:00
parent c79bf5790d
commit 3e3fffff65
No known key found for this signature in database

View file

@ -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