mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
dispatch: take over SignalInterrupt handling from scmutil
dispatch handles KeyboardInterrupt already. This makes the code more consistent, and makes worker not print "killed!" if it receives SIGTERM in most cases (in rare cases there is still "killed!" printed, which will be fixed by the next patch).
This commit is contained in:
parent
053ec75639
commit
1894115dcb
@ -162,9 +162,13 @@ def dispatch(req):
|
||||
ret = None
|
||||
try:
|
||||
ret = _runcatch(req)
|
||||
except KeyboardInterrupt:
|
||||
except KeyboardInterrupt as inst:
|
||||
try:
|
||||
req.ui.warn(_("interrupted!\n"))
|
||||
if isinstance(inst, error.SignalInterrupt):
|
||||
msg = _("killed!\n")
|
||||
else:
|
||||
msg = _("interrupted!\n")
|
||||
req.ui.warn(msg)
|
||||
except error.SignalInterrupt:
|
||||
# maybe pager would quit without consuming all the output, and
|
||||
# SIGPIPE was raised. we cannot print anything in this case.
|
||||
|
@ -186,8 +186,6 @@ def callcatch(ui, func):
|
||||
ui.warn(_("abort: file censored %s!\n") % inst)
|
||||
except error.RevlogError as inst:
|
||||
ui.warn(_("abort: %s!\n") % inst)
|
||||
except error.SignalInterrupt:
|
||||
ui.warn(_("killed!\n"))
|
||||
except error.InterventionRequired as inst:
|
||||
ui.warn("%s\n" % inst)
|
||||
if inst.hint:
|
||||
|
Loading…
Reference in New Issue
Block a user