worker: print traceback for uncaught exception unconditionally
This is what a Python interpreter would do if there were no os._exit().
--- 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):