##// END OF EJS Templates
dispatch: catch KeyboardInterrupt more broadly...
Yuya Nishihara -
r28520:84cc72c5 default
parent child Browse files
Show More
@@ -120,11 +120,18 b' def dispatch(req):'
120 ret = None
120 ret = None
121 try:
121 try:
122 ret = _runcatch(req)
122 ret = _runcatch(req)
123 return ret
123 except KeyboardInterrupt:
124 try:
125 req.ui.warn(_("interrupted!\n"))
126 except IOError as inst:
127 if inst.errno != errno.EPIPE:
128 raise
129 ret = -1
124 finally:
130 finally:
125 duration = time.time() - starttime
131 duration = time.time() - starttime
126 req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n",
132 req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n",
127 msg, ret or 0, duration)
133 msg, ret or 0, duration)
134 return ret
128
135
129 def _runcatch(req):
136 def _runcatch(req):
130 def catchterm(*args):
137 def catchterm(*args):
@@ -313,11 +320,7 b' def _runcatch(req):'
313 else:
320 else:
314 ui.warn(_("abort: %s\n") % inst.strerror)
321 ui.warn(_("abort: %s\n") % inst.strerror)
315 except KeyboardInterrupt:
322 except KeyboardInterrupt:
316 try:
323 raise
317 ui.warn(_("interrupted!\n"))
318 except IOError as inst:
319 if inst.errno != errno.EPIPE:
320 raise
321 except MemoryError:
324 except MemoryError:
322 ui.warn(_("abort: out of memory\n"))
325 ui.warn(_("abort: out of memory\n"))
323 except SystemExit as inst:
326 except SystemExit as inst:
General Comments 0
You need to be logged in to leave comments. Login now