From 3daeb3ca6016c7e57713ae32d57aff07da6fd846 Mon Sep 17 00:00:00 2001 From: jjgarcia Date: Tue, 11 Jan 2005 14:40:37 +0000 Subject: [PATCH] User break (Ctrl+C) is now captured under windows --- src/c/unixint.d | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/c/unixint.d b/src/c/unixint.d index 19dea53f1..96a3ef077 100644 --- a/src/c/unixint.d +++ b/src/c/unixint.d @@ -170,6 +170,18 @@ LONG WINAPI W32_exception_filter(struct _EXCEPTION_POINTERS* ep) return excpt_result; } + +BOOL WINAPI W32_console_ctrl_handler(DWORD type) +{ + switch (type) + { + /* Catch CTRL-C */ + case CTRL_C_EVENT: + handle_signal(SIGINT); + return TRUE; + } + return FALSE; +} #endif void @@ -182,6 +194,7 @@ init_unixint(void) #endif #ifdef _MSC_VER SetUnhandledExceptionFilter(W32_exception_filter); + SetConsoleCtrlHandler(W32_console_ctrl_handler, TRUE); #endif ECL_SET(@'si::*interrupt-enable*', Ct); ecl_interrupt_enable = 1;