Show More
@@ -130,6 +130,13 b' class AmbiguousCommand(Exception):' | |||||
130 | __bytes__ = _tobytes |
|
130 | __bytes__ = _tobytes | |
131 |
|
131 | |||
132 |
|
132 | |||
|
133 | class WorkerError(Exception): | |||
|
134 | """Exception raised when a worker process dies.""" | |||
|
135 | ||||
|
136 | def __init__(self, status_code): | |||
|
137 | self.status_code = status_code | |||
|
138 | ||||
|
139 | ||||
133 | class InterventionRequired(Hint, Exception): |
|
140 | class InterventionRequired(Hint, Exception): | |
134 | """Exception raised when a command requires human intervention.""" |
|
141 | """Exception raised when a command requires human intervention.""" | |
135 |
|
142 |
@@ -219,6 +219,9 b' def callcatch(ui, func):' | |||||
219 | ui.error(_(b"abort: %s\n") % inst.message) |
|
219 | ui.error(_(b"abort: %s\n") % inst.message) | |
220 | if inst.hint: |
|
220 | if inst.hint: | |
221 | ui.error(_(b"(%s)\n") % inst.hint) |
|
221 | ui.error(_(b"(%s)\n") % inst.hint) | |
|
222 | except error.WorkerError as inst: | |||
|
223 | # Don't print a message -- the worker already should have | |||
|
224 | return inst.status_code | |||
222 | except ImportError as inst: |
|
225 | except ImportError as inst: | |
223 | ui.error(_(b"abort: %s!\n") % stringutil.forcebytestr(inst)) |
|
226 | ui.error(_(b"abort: %s!\n") % stringutil.forcebytestr(inst)) | |
224 | m = stringutil.forcebytestr(inst).split()[-1] |
|
227 | m = stringutil.forcebytestr(inst).split()[-1] |
@@ -300,7 +300,7 b' def _posixworker(ui, func, staticargs, a' | |||||
300 | if status: |
|
300 | if status: | |
301 | if status < 0: |
|
301 | if status < 0: | |
302 | os.kill(os.getpid(), -status) |
|
302 | os.kill(os.getpid(), -status) | |
303 |
|
|
303 | raise error.WorkerError(status) | |
304 | if hasretval: |
|
304 | if hasretval: | |
305 | yield True, retval |
|
305 | yield True, retval | |
306 |
|
306 |
@@ -85,11 +85,12 b' Known exception should be caught, but pr' | |||||
85 | [255] |
|
85 | [255] | |
86 |
|
86 | |||
87 | $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=8' \ |
|
87 | $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=8' \ | |
88 |
> test 100000.0 abort --traceback 2>&1 | egrep '( |
|
88 | > test 100000.0 abort --traceback 2>&1 | egrep '(WorkerError|Abort)' | |
89 | raise error.Abort(b'known exception') |
|
89 | raise error.Abort(b'known exception') | |
90 | mercurial.error.Abort: known exception (py3 !) |
|
90 | mercurial.error.Abort: known exception (py3 !) | |
91 | Abort: known exception (no-py3 !) |
|
91 | Abort: known exception (no-py3 !) | |
92 | SystemExit: 255 |
|
92 | raise error.WorkerError(status) | |
|
93 | mercurial.error.WorkerError: 255 | |||
93 |
|
94 | |||
94 | Traceback must be printed for unknown exceptions |
|
95 | Traceback must be printed for unknown exceptions | |
95 |
|
96 |
General Comments 0
You need to be logged in to leave comments.
Login now