##// END OF EJS Templates
worker: propagate exit code to main process...
Yuya Nishihara -
r32042:8f8ad013 default
parent child Browse files
Show More
@@ -144,13 +144,15 b' def _posixworker(ui, func, staticargs, a'
144 os.close(rfd)
144 os.close(rfd)
145 for i, item in func(*(staticargs + (pargs,))):
145 for i, item in func(*(staticargs + (pargs,))):
146 os.write(wfd, '%d %s\n' % (i, item))
146 os.write(wfd, '%d %s\n' % (i, item))
147 return 0
147
148
148 # make sure we use os._exit in all code paths. otherwise the worker
149 # make sure we use os._exit in all code paths. otherwise the worker
149 # may do some clean-ups which could cause surprises like deadlock.
150 # may do some clean-ups which could cause surprises like deadlock.
150 # see sshpeer.cleanup for example.
151 # see sshpeer.cleanup for example.
152 ret = 0
151 try:
153 try:
152 try:
154 try:
153 scmutil.callcatch(ui, workerfunc)
155 ret = scmutil.callcatch(ui, workerfunc)
154 finally:
156 finally:
155 ui.flush()
157 ui.flush()
156 except KeyboardInterrupt:
158 except KeyboardInterrupt:
@@ -162,7 +164,7 b' def _posixworker(ui, func, staticargs, a'
162 finally:
164 finally:
163 os._exit(255)
165 os._exit(255)
164 else:
166 else:
165 os._exit(0)
167 os._exit(ret & 255)
166 pids.add(pid)
168 pids.add(pid)
167 os.close(wfd)
169 os.close(wfd)
168 fp = os.fdopen(rfd, pycompat.sysstr('rb'), 0)
170 fp = os.fdopen(rfd, pycompat.sysstr('rb'), 0)
@@ -70,8 +70,9 b' Known exception should be caught, but pr'
70 > test 100000.0 abort
70 > test 100000.0 abort
71 start
71 start
72 abort: known exception
72 abort: known exception
73 done
73 [255]
74
74
75 $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \
75 $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \
76 > test 100000.0 abort --traceback 2>&1 | grep '^Traceback'
76 > test 100000.0 abort --traceback 2>&1 | grep '^Traceback'
77 Traceback (most recent call last):
77 Traceback (most recent call last):
78 Traceback (most recent call last):
General Comments 0
You need to be logged in to leave comments. Login now