mercurial/util_win32.py
changeset 4672 272c0a09b203
parent 4407 f97b89314fb3
child 4803 7549cd526b7f
--- a/mercurial/util_win32.py	Thu Jun 21 09:25:49 2007 +0200
+++ b/mercurial/util_win32.py	Thu Jun 21 21:58:18 2007 +0200
@@ -299,3 +299,12 @@
             raise WinIOError(err)
 
 getuser_fallback = win32api.GetUserName
+
+def set_signal_handler():
+    """Register a termination handler for console events including
+    CTRL+C. python signal handlers do not work well with socket
+    operations.
+    """
+    def handler(event):
+        win32process.ExitProcess(1)
+    win32api.SetConsoleCtrlHandler(handler)