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.
--- 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