mercurial/dispatch.py
branchstable
changeset 10952 6c2c766afefe
parent 10793 16df09a54113
child 10962 8d5f5122a732
child 11053 59d0d715fbfa
--- a/mercurial/dispatch.py	Thu Apr 01 22:04:30 2010 +0100
+++ b/mercurial/dispatch.py	Wed Apr 07 02:41:22 2010 +0200
@@ -33,10 +33,13 @@
     def catchterm(*args):
         raise error.SignalInterrupt
 
-    for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
-        num = getattr(signal, name, None)
-        if num:
-            signal.signal(num, catchterm)
+    try:
+        for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
+            num = getattr(signal, name, None)
+            if num:
+                signal.signal(num, catchterm)
+    except ValueError:
+        pass # happens if called in a thread
 
     try:
         try: