# HG changeset patch # User Yuya Nishihara # Date 1492230464 -32400 # Node ID 8f8ad0139b8b048a51d395754c233b93d6fba6e3 # Parent 38963a53ab0dba29711b5a4d6f21147064d05259 worker: propagate exit code to main process Follows up 86cd09bc13ba. diff -r 38963a53ab0d -r 8f8ad0139b8b mercurial/worker.py --- a/mercurial/worker.py Sat Apr 15 13:02:34 2017 +0900 +++ b/mercurial/worker.py Sat Apr 15 13:27:44 2017 +0900 @@ -144,13 +144,15 @@ os.close(rfd) for i, item in func(*(staticargs + (pargs,))): os.write(wfd, '%d %s\n' % (i, item)) + return 0 # make sure we use os._exit in all code paths. otherwise the worker # may do some clean-ups which could cause surprises like deadlock. # see sshpeer.cleanup for example. + ret = 0 try: try: - scmutil.callcatch(ui, workerfunc) + ret = scmutil.callcatch(ui, workerfunc) finally: ui.flush() except KeyboardInterrupt: @@ -162,7 +164,7 @@ finally: os._exit(255) else: - os._exit(0) + os._exit(ret & 255) pids.add(pid) os.close(wfd) fp = os.fdopen(rfd, pycompat.sysstr('rb'), 0) diff -r 38963a53ab0d -r 8f8ad0139b8b tests/test-worker.t --- a/tests/test-worker.t Sat Apr 15 13:02:34 2017 +0900 +++ b/tests/test-worker.t Sat Apr 15 13:27:44 2017 +0900 @@ -70,8 +70,9 @@ > test 100000.0 abort start abort: known exception - done + [255] $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \ > test 100000.0 abort --traceback 2>&1 | grep '^Traceback' Traceback (most recent call last): + Traceback (most recent call last):