Mercurial > hg
changeset 40988:03f7d0822ec1 stable
worker: do not swallow exception occurred in main process
Before, SystemExit(255) would be most likely raised since the worker processes
were terminated by the main process and the status would be set to 255 in
response. We should instead re-raise the exception occurred first. It's pretty
hard to debug problems like the issue 6035 with no traceback.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 11 Dec 2018 22:34:07 +0900 |
parents | bb5d74a35477 |
children | e10adebf8176 d7d3164e6a31 |
files | mercurial/worker.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/worker.py Mon Dec 17 20:46:09 2018 +0900 +++ b/mercurial/worker.py Tue Dec 11 22:34:07 2018 +0900 @@ -213,11 +213,7 @@ waitforworkers() signal.signal(signal.SIGCHLD, oldchldhandler) selector.close() - status = problem[0] - if status: - if status < 0: - os.kill(os.getpid(), -status) - sys.exit(status) + return problem[0] try: openpipes = len(pipes) while openpipes > 0: @@ -236,7 +232,11 @@ killworkers() cleanup() raise - cleanup() + status = cleanup() + if status: + if status < 0: + os.kill(os.getpid(), -status) + sys.exit(status) def _posixexitstatus(code): '''convert a posix exit status into the same form returned by