Mercurial > hg
changeset 32043:b844d0d367e2
worker: print traceback for uncaught exception unconditionally
This is what a Python interpreter would do if there were no os._exit().
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 15 Apr 2017 13:04:55 +0900 |
parents | 8f8ad0139b8b |
children | cde72a195f32 |
files | mercurial/worker.py tests/test-worker.t |
diffstat | 2 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/worker.py Sat Apr 15 13:27:44 2017 +0900 +++ b/mercurial/worker.py Sat Apr 15 13:04:55 2017 +0900 @@ -159,7 +159,7 @@ os._exit(255) except: # never return, therefore no re-raises try: - ui.traceback() + ui.traceback(force=True) ui.flush() finally: os._exit(255)
--- a/tests/test-worker.t Sat Apr 15 13:27:44 2017 +0900 +++ b/tests/test-worker.t Sat Apr 15 13:04:55 2017 +0900 @@ -13,12 +13,18 @@ > # by first worker for test stability > raise error.Abort('known exception') > return runme(ui, []) + > def exc(ui, args): + > if args[0] == 0: + > # by first worker for test stability + > raise Exception('unknown exception') + > return runme(ui, []) > def runme(ui, args): > for arg in args: > ui.status('run\n') > yield 1, arg > functable = { > 'abort': abort, + > 'exc': exc, > 'runme': runme, > } > cmdtable = {} @@ -76,3 +82,9 @@ > test 100000.0 abort --traceback 2>&1 | grep '^Traceback' Traceback (most recent call last): Traceback (most recent call last): + +Traceback must be printed for unknown exceptions + + $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \ + > test 100000.0 exc 2>&1 | grep '^Traceback' + Traceback (most recent call last):