summaryrefslogtreecommitdiff
path: root/stdlib/headernt.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2001-11-27 12:58:19 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2001-11-27 12:58:19 +0000
commit13624485981022db9f0444bdd0a6902918d7dd15 (patch)
tree17c2e56c66f15dc9e52ea0d558c08c9b3e929585 /stdlib/headernt.c
parentda7d14df3af664b09cef14455b517c4f7e324826 (diff)
downloadocaml-13624485981022db9f0444bdd0a6902918d7dd15.tar.gz
Ctrl-C madness
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4048 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/headernt.c')
-rw-r--r--stdlib/headernt.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/stdlib/headernt.c b/stdlib/headernt.c
index 3c8be3151e..2394ae9d01 100644
--- a/stdlib/headernt.c
+++ b/stdlib/headernt.c
@@ -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;