-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
workers: fix invalid exit code in parent upon uncaught exception #21713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
483cdec
180abec
004c004
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -445,6 +445,9 @@ function setupChild(evalScript) { | |
|
|
||
| function fatalException(error) { | ||
| debug(`[${threadId}] gets fatal exception`); | ||
|
|
||
| process.exitCode = 1; | ||
|
||
|
|
||
| let caught = false; | ||
| try { | ||
| caught = originalFatalException.call(this, error); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid process.exitCode may be 1 even if the exception is caught.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree – I think you want to move this into the
if (!caught)block below?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I assumed that this was unrecoverable (I thought 'uncaughtException' didn't count as recovery). Will push soon. I also added test similar to
test-process-exit-codefor workers.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think behaviour should match the main thread’s behaviour as closely as possible – in there, we have that
process.exitCodeis not set, as far as I can tell:prints
undefined.