app: Catch CTRL + C signal on Windows attached console

This solves the second issue noted on the last paragraph of 9e795acb
This commit is contained in:
Bruno Lopes 2025-11-08 10:03:09 -03:00
parent 5ff80c7dfb
commit 8913271706
No known key found for this signature in database

View file

@ -959,6 +959,16 @@ gimp_attach_console_window (void)
freopen ("CONOUT$", "w", stderr);
_flushall ();
{
/* CTRL+C handling */
HANDLE hIn = GetStdHandle (STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode (hIn, &mode);
mode |= ENABLE_PROCESSED_INPUT;
SetConsoleMode (hIn, mode);
}
atexit (wait_console_window);
}
}