summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2007-04-16 10:52:25 -0700
committerSteve Hay <SteveHay@planit.com>2007-04-19 12:15:30 +0000
commit0a311364e00e9bf5b4fcb140ade49b02e46833dd (patch)
treefd03c782e1257e30aa39d562c9a49121baf45746 /win32/win32.c
parent3b29be8d36f4d89172a614c23fd56316977b2d95 (diff)
downloadperl-0a311364e00e9bf5b4fcb140ade49b02e46833dd.tar.gz
Allow sending SIGINT to child processes on Windows *if* they are running Perl
From: "Jan Dubois" <jand@activestate.com> Message-ID: <01e301c7808a$ac0cca30$04265e90$@com> p4raw-id: //depot/perl@30979
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 55239e53e0..c69c2a7bda 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4910,6 +4910,16 @@ Perl_sys_intern_init(pTHX)
/* Force C runtime signal stuff to set its console handler */
signal(SIGINT,win32_csighandler);
signal(SIGBREAK,win32_csighandler);
+
+ /* We spawn asynchronous processes with the CREATE_NEW_PROCESS_GROUP
+ * flag. This has the side-effect of disabling Ctrl-C events in all
+ * processes in this group. At least on Windows NT and later we
+ * can re-enable Ctrl-C handling by calling SetConsoleCtrlHandler()
+ * with a NULL handler. This is not valid on Windows 9X.
+ */
+ if (IsWinNT())
+ SetConsoleCtrlHandler(NULL,FALSE);
+
/* Push our handler on top */
SetConsoleCtrlHandler(win32_ctrlhandler,TRUE);
}