summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDenys Otrishko <shishugi@gmail.com>2018-07-09 01:44:27 +0300
committerAnna Henningsen <anna@addaleax.net>2018-07-11 00:16:53 +0200
commit1e9c3f868ce9b028353ceab831abaf18a78f86b8 (patch)
tree83036587e76c3900ba52ae0c4b1287c8ba47ca09 /lib
parent538acead6670d711ddb71c0b852089b792c996e3 (diff)
downloadandroid-node-v8-1e9c3f868ce9b028353ceab831abaf18a78f86b8.tar.gz
android-node-v8-1e9c3f868ce9b028353ceab831abaf18a78f86b8.tar.bz2
android-node-v8-1e9c3f868ce9b028353ceab831abaf18a78f86b8.zip
workers: fix invalid exit code in parent upon uncaught exception
Now worker.on('exit') reports correct exit code (1) if worker has exited with uncaught exception. Fixes: https://github.com/nodejs/node/issues/21707 PR-URL: https://github.com/nodejs/node/pull/21713 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/worker.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/internal/worker.js b/lib/internal/worker.js
index bcc864b5b8..83389d204d 100644
--- a/lib/internal/worker.js
+++ b/lib/internal/worker.js
@@ -454,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);