Ctrl-C madness

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4048 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 2001-11-27 12:58:19 +00:00
parent da7d14df3a
commit 1362448598
1 changed files with 12 additions and 0 deletions

View File

@ -71,6 +71,14 @@ static __inline char * read_runtime_path(HANDLE h)
return runtime_path;
}
static BOOL WINAPI ctrl_handler(DWORD event)
{
if (event == CTRL_C_EVENT || event == CTRL_BREAK_EVENT)
return TRUE; /* pretend we've handled them */
else
return FALSE;
}
#define msg_and_length(msg) msg , (sizeof(msg) - 1)
static __inline void __declspec(noreturn) run_runtime(char * runtime,
@ -92,6 +100,10 @@ static __inline void __declspec(noreturn) run_runtime(char * runtime,
__assume(0); /* Not reached */
#endif
}
/* Need to ignore ctrl-C and ctrl-break, otherwise we'll die and take
the underlying OCaml program with us! */
SetConsoleCtrlHandler(ctrl_handler, TRUE);
stinfo.cb = sizeof(stinfo);
stinfo.lpReserved = NULL;
stinfo.lpDesktop = NULL;