Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! workers: fix invalid exit code in parent upon uncaught exception
  • Loading branch information
lundibundi committed Jul 9, 2018
commit 004c004b740d57b32c7c71a8f91c3792e568dc2d
11 changes: 3 additions & 8 deletions lib/internal/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,6 @@ function setupChild(evalScript) {

function fatalException(error) {
debug(`[${threadId}] gets fatal exception`);

// set exit code for local worker's 'exit' listeners
process.exitCode = 1;

let caught = false;
try {
caught = originalFatalException.call(this, error);
Expand All @@ -458,6 +454,9 @@ function setupChild(evalScript) {
debug(`[${threadId}] fatal exception caught = ${caught}`);

if (!caught) {
// set correct code (uncaughtException) for [kOnExit](code) handler
process.exitCode = 1;

let serialized;
try {
serialized = serializeError(error);
Expand All @@ -471,10 +470,6 @@ function setupChild(evalScript) {
else
port.postMessage({ type: messageTypes.COULD_NOT_SERIALIZE_ERROR });
clearAsyncIdStack();
} else if (process.exitCode === 1) {
// user caught an exception and didn't change the exit code -> assume it
// was handled
process.exitCode = 0;
}
}
}
Expand Down