crecord: extract most of 'main' into a sub function
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Sun, 26 Mar 2017 15:05:12 +0200
changeset 31929 bf6b44da1d8e
parent 31928 277b3e2d711b
child 31930 7e7743a01103
crecord: extract most of 'main' into a sub function There are some setup and cleanup necessary around the main code, that setup/cleanup code needs multiple adjustments so we extract the core code into its own function first for clarity.
mercurial/crecord.py
--- a/mercurial/crecord.py	Mon Apr 03 23:13:49 2017 +0900
+++ b/mercurial/crecord.py	Sun Mar 26 15:05:12 2017 +0200
@@ -1616,6 +1616,10 @@
 
         origsigwinchhandler = signal.signal(signal.SIGWINCH,
                                             self.sigwinchhandler)
+        return self._main(stdscr)
+        signal.signal(signal.SIGWINCH, origsigwinchhandler)
+
+    def _main(self, stdscr):
         self.stdscr = stdscr
         # error during initialization, cannot be printed in the curses
         # interface, it should be printed by the calling code
@@ -1667,4 +1671,3 @@
                 keypressed = "foobar"
             if self.handlekeypressed(keypressed):
                 break
-        signal.signal(signal.SIGWINCH, origsigwinchhandler)