crecord: suspend progress bar when displaying the curses interface

Summary:
Nothing currently displays a progress bar while the curses interface is shown,
but in the future something may be added which does, so ensure the progress bar
is suspended when showing the curses interface.

Reviewed By: ryanmce

Differential Revision: D7417435

fbshipit-source-id: 6b91b17ee5390cbde6e983081a0940051ab865c8
This commit is contained in:
Mark Thomas 2018-03-28 04:13:12 -07:00 committed by Saurabh Singh
parent 633d10fe2b
commit dbf70dc3fd

View File

@ -20,6 +20,7 @@ from . import (
encoding,
error,
patch as patchmod,
progress,
scmutil,
util,
)
@ -525,10 +526,11 @@ def chunkselector(ui, headerlist, operation=None):
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
with progress.suspend():
curses.wrapper(chunkselector.main)
if chunkselector.initerr is not None:
raise error.Abort(chunkselector.initerr)
# ncurses does not restore signal handler for SIGTSTP
finally:
if origsigtstp is not sentinel:
signal.signal(signal.SIGTSTP, origsigtstp)