crecord: avoid setting non-existing signal SIGWINCH on windows
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Thu, 06 Apr 2017 11:25:33 +0200
changeset 31931 0130c3e1b1d9
parent 31930 7e7743a01103
child 31932 20a68f714f9b
crecord: avoid setting non-existing signal SIGWINCH on windows Windows do not have a SIGWINCH so we avoid setting the handler if the signal is unknown.
mercurial/crecord.py
--- a/mercurial/crecord.py	Sun Mar 26 15:06:09 2017 +0200
+++ b/mercurial/crecord.py	Thu Apr 06 11:25:33 2017 +0200
@@ -1614,12 +1614,15 @@
         method to be wrapped by curses.wrapper() for selecting chunks.
         """
 
-        origsigwinchhandler = signal.signal(signal.SIGWINCH,
-                                            self.sigwinchhandler)
+        origsigwinch = sentinel = object()
+        if util.safehasattr(signal, 'SIGWINCH'):
+            origsigwinch = signal.signal(signal.SIGWINCH,
+                                         self.sigwinchhandler)
         try:
             return self._main(stdscr)
         finally:
-            signal.signal(signal.SIGWINCH, origsigwinchhandler)
+            if origsigwinch is not sentinel:
+                signal.signal(signal.SIGWINCH, origsigwinch)
 
     def _main(self, stdscr):
         self.stdscr = stdscr