Ctrl-C madness
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4048 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
da7d14df3a
commit
1362448598
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue