Mercurial > hg
changeset 31933:b2478a996a82
crecord: avoid setting non-existing SIGTSTP signal on windows (issue5512)
Windows do not have a SIGTSTP so we avoid setting the handler if the signal is
unknown.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 06 Apr 2017 11:28:25 +0200 |
parents | 20a68f714f9b |
children | 12aca6770046 |
files | mercurial/crecord.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/crecord.py Thu Apr 06 11:25:13 2017 +0200 +++ b/mercurial/crecord.py Thu Apr 06 11:28:25 2017 +0200 @@ -473,14 +473,17 @@ """ ui.write(_('starting interactive selection\n')) chunkselector = curseschunkselector(headerlist, ui, operation) - f = signal.getsignal(signal.SIGTSTP) + origsigtstp = sentinel = object() + if util.safehasattr(signal, 'SIGTSTP'): + origsigtstp = signal.getsignal(signal.SIGTSTP) 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) + if origsigtstp is not sentinel: + signal.signal(signal.SIGTSTP, origsigtstp) return chunkselector.opts def testdecorator(testfn, f):