Mercurial > hg
changeset 31932:20a68f714f9b
crecord: ensure we reinstall the SIGTSTP handler
Previous, exceptions would prevent the reinstallation of the
signal.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 06 Apr 2017 11:25:13 +0200 |
parents | 0130c3e1b1d9 |
children | b2478a996a82 |
files | mercurial/crecord.py |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/crecord.py Thu Apr 06 11:25:33 2017 +0200 +++ b/mercurial/crecord.py Thu Apr 06 11:25:13 2017 +0200 @@ -474,11 +474,13 @@ ui.write(_('starting interactive selection\n')) chunkselector = curseschunkselector(headerlist, ui, operation) f = signal.getsignal(signal.SIGTSTP) - curses.wrapper(chunkselector.main) - if chunkselector.initerr is not None: - raise error.Abort(chunkselector.initerr) - # ncurses does not restore signal handler for SIGTSTP - signal.signal(signal.SIGTSTP, f) + try: + curses.wrapper(chunkselector.main) + if chunkselector.initerr is not None: + raise error.Abort(chunkselector.initerr) + # ncurses does not restore signal handler for SIGTSTP + finally: + signal.signal(signal.SIGTSTP, f) return chunkselector.opts def testdecorator(testfn, f):