comparison mercurial/dispatch.py @ 32111:1208b74841ff

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).
author Jun Wu <quark@fb.com>
date Sat, 22 Apr 2017 15:00:17 -0700
parents 616e788321cc
children c3dcec6cbc1b
comparison
equal deleted inserted replaced
32110:6cacc271ee0a 32111:1208b74841ff
160 msg = _formatargs(req.args) 160 msg = _formatargs(req.args)
161 starttime = util.timer() 161 starttime = util.timer()
162 ret = None 162 ret = None
163 try: 163 try:
164 ret = _runcatch(req) 164 ret = _runcatch(req)
165 except KeyboardInterrupt: 165 except KeyboardInterrupt as inst:
166 try: 166 try:
167 req.ui.warn(_("interrupted!\n")) 167 if isinstance(inst, error.SignalInterrupt):
168 msg = _("killed!\n")
169 else:
170 msg = _("interrupted!\n")
171 req.ui.warn(msg)
168 except error.SignalInterrupt: 172 except error.SignalInterrupt:
169 # maybe pager would quit without consuming all the output, and 173 # maybe pager would quit without consuming all the output, and
170 # SIGPIPE was raised. we cannot print anything in this case. 174 # SIGPIPE was raised. we cannot print anything in this case.
171 pass 175 pass
172 except IOError as inst: 176 except IOError as inst: