inotify: catch SignalInterrupt during shutdown (issue3351) stable
authorThomas Arendsen Hein <thomas@intevation.de>
Wed, 04 Apr 2012 10:57:48 +0200
branchstable
changeset 16354 9f98fe05ecf1
parent 16352 4d875bb546dc
child 16355 cb1475e7e5a2
inotify: catch SignalInterrupt during shutdown (issue3351) When inotify.repowatcher.shutdown() is called, mercurial.error.SignalInterrupt exception is thrown by mercurial.dispatch._runcatch.catchterm(), therefore socketlistener.shutdown() is not called. Catching this allows cleanup action (removing the socket file) to proceed.
hgext/inotify/linuxserver.py
--- a/hgext/inotify/linuxserver.py	Tue Apr 03 22:01:28 2012 +0200
+++ b/hgext/inotify/linuxserver.py	Wed Apr 04 10:57:48 2012 +0200
@@ -7,7 +7,7 @@
 # GNU General Public License version 2 or any later version.
 
 from mercurial.i18n import _
-from mercurial import osutil, util
+from mercurial import osutil, util, error
 import server
 import errno, os, select, stat, sys, time
 
@@ -431,7 +431,10 @@
 
     def shutdown(self):
         for obj in pollable.instances.itervalues():
-            obj.shutdown()
+            try:
+                obj.shutdown()
+            except error.SignalInterrupt:
+                pass
 
     def run(self):
         self.repowatcher.setup()