changeset 31930:7e7743a01103

crecord: ensure we reinstall the SIGWINCH handler Previous, exception in _main(...) would prevent the reinstallation of the signal.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Sun, 26 Mar 2017 15:06:09 +0200
parents bf6b44da1d8e
children 0130c3e1b1d9
files mercurial/crecord.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/crecord.py	Sun Mar 26 15:05:12 2017 +0200
+++ b/mercurial/crecord.py	Sun Mar 26 15:06:09 2017 +0200
@@ -1616,8 +1616,10 @@
 
         origsigwinchhandler = signal.signal(signal.SIGWINCH,
                                             self.sigwinchhandler)
-        return self._main(stdscr)
-        signal.signal(signal.SIGWINCH, origsigwinchhandler)
+        try:
+            return self._main(stdscr)
+        finally:
+            signal.signal(signal.SIGWINCH, origsigwinchhandler)
 
     def _main(self, stdscr):
         self.stdscr = stdscr