# HG changeset patch # User Yuya Nishihara # Date 2017-04-15 04:04:55 # Node ID b844d0d367e298688e491d2f18accc53e30b63e9 # Parent 8f8ad0139b8b048a51d395754c233b93d6fba6e3 worker: print traceback for uncaught exception unconditionally This is what a Python interpreter would do if there were no os._exit(). diff --git a/mercurial/worker.py b/mercurial/worker.py --- a/mercurial/worker.py +++ b/mercurial/worker.py @@ -159,7 +159,7 @@ def _posixworker(ui, func, staticargs, a os._exit(255) except: # never return, therefore no re-raises try: - ui.traceback() + ui.traceback(force=True) ui.flush() finally: os._exit(255) diff --git a/tests/test-worker.t b/tests/test-worker.t --- a/tests/test-worker.t +++ b/tests/test-worker.t @@ -13,12 +13,18 @@ Test UI worker interaction > # 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 @@ Known exception should be caught, but pr > 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):