summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-01-28 16:20:40 +0100
committerAnna Henningsen <anna@addaleax.net>2019-01-30 18:17:26 +0100
commit7fa5157497389cbc90766680f85921b8aa458c9d (patch)
tree9a436f89b6a01bb2c9a1e4af971961909f298919 /lib
parent94ebf3f0a733902477674d6cc945ad052755bb28 (diff)
downloadandroid-node-v8-7fa5157497389cbc90766680f85921b8aa458c9d.tar.gz
android-node-v8-7fa5157497389cbc90766680f85921b8aa458c9d.tar.bz2
android-node-v8-7fa5157497389cbc90766680f85921b8aa458c9d.zip
module: do not use `process.exit()`
Inside workers, using stdio is always asynchronous, so using `process.exit()` always interrupts sending of messages to the parent thread, including error messages presented over stdio. Do not use `process.exit()` and instead trigger a “real” uncaught exception. PR-URL: https://github.com/nodejs/node/pull/25769 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/modules/cjs/loader.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index 8b357e5254..3405ef4322 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -60,14 +60,12 @@ module.exports = Module;
let asyncESM;
let ModuleJob;
let createDynamicModule;
-let decorateErrorStack;
function lazyLoadESM() {
asyncESM = require('internal/process/esm_loader');
ModuleJob = require('internal/modules/esm/module_job');
createDynamicModule = require(
'internal/modules/esm/create_dynamic_module');
- decorateErrorStack = require('internal/util').decorateErrorStack;
}
const {
@@ -794,9 +792,7 @@ Module.runMain = function() {
return loader.import(pathToFileURL(process.argv[1]).pathname);
})
.catch((e) => {
- decorateErrorStack(e);
- console.error(e);
- process.exit(1);
+ internalBinding('util').triggerFatalException(e);
});
} else {
Module._load(process.argv[1], null, true);