Mercurial > public > mercurial-scm > hg
diff mercurial/worker.py @ 32042:8f8ad0139b8b
worker: propagate exit code to main process
Follows up 86cd09bc13ba.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 15 Apr 2017 13:27:44 +0900 |
parents | 9d3d56aa1a9f |
children | b844d0d367e2 |
line wrap: on
line diff
--- 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)