Patchwork [2,of,5,STABLE] crecord: ensure we reinstall the SIGWINCH handler

login
register
mail settings
Submitter Pierre-Yves David
Date April 12, 2017, 8:41 a.m.
Message ID <85d5c3551f2b44399418.1491986477@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20131/
State Accepted
Headers show

Comments

Pierre-Yves David - April 12, 2017, 8:41 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1490533569 -7200
#      Sun Mar 26 15:06:09 2017 +0200
# Branch stable
# Node ID 85d5c3551f2b44399418e00fd62630344694ed1c
# Parent  a8c09dc71f99e929d2545ee4366231aa98d73d9d
# EXP-Topic crecord-windows
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 85d5c3551f2b
crecord: ensure we reinstall the SIGWINCH handler

Previous, exception in _main(...) would prevent the reinstallation of the
signal.

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -1613,8 +1613,10 @@  are you sure you want to review/edit and
 
         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