Mercurial > hg
changeset 31931:0130c3e1b1d9
crecord: avoid setting non-existing signal SIGWINCH on windows
Windows do not have a SIGWINCH 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:25:33 +0200 |
parents | 7e7743a01103 |
children | 20a68f714f9b |
files | mercurial/crecord.py |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/crecord.py Sun Mar 26 15:06:09 2017 +0200 +++ b/mercurial/crecord.py Thu Apr 06 11:25:33 2017 +0200 @@ -1614,12 +1614,15 @@ method to be wrapped by curses.wrapper() for selecting chunks. """ - origsigwinchhandler = signal.signal(signal.SIGWINCH, - self.sigwinchhandler) + origsigwinch = sentinel = object() + if util.safehasattr(signal, 'SIGWINCH'): + origsigwinch = signal.signal(signal.SIGWINCH, + self.sigwinchhandler) try: return self._main(stdscr) finally: - signal.signal(signal.SIGWINCH, origsigwinchhandler) + if origsigwinch is not sentinel: + signal.signal(signal.SIGWINCH, origsigwinch) def _main(self, stdscr): self.stdscr = stdscr