diff -r 518a5030acba -r 84cc72c5771e mercurial/dispatch.py --- a/mercurial/dispatch.py Sun Mar 13 16:46:49 2016 -0700 +++ b/mercurial/dispatch.py Sun Dec 27 13:38:46 2015 +0900 @@ -120,11 +120,18 @@ ret = None try: ret = _runcatch(req) - return ret + except KeyboardInterrupt: + try: + req.ui.warn(_("interrupted!\n")) + except IOError as inst: + if inst.errno != errno.EPIPE: + raise + ret = -1 finally: duration = time.time() - starttime req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n", msg, ret or 0, duration) + return ret def _runcatch(req): def catchterm(*args): @@ -313,11 +320,7 @@ else: ui.warn(_("abort: %s\n") % inst.strerror) except KeyboardInterrupt: - try: - ui.warn(_("interrupted!\n")) - except IOError as inst: - if inst.errno != errno.EPIPE: - raise + raise except MemoryError: ui.warn(_("abort: out of memory\n")) except SystemExit as inst: