From b44131ab927008edff85a9efb196e1e192d28a29 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 1 Feb 2019 08:28:05 +0800 Subject: lib: use `internal/options` to query `--abort-on-uncaught-exception` Instead of using `internalBinding('config').shouldAbortOnUncaughtException`. Also removes that property from the binding. PR-URL: https://github.com/nodejs/node/pull/25862 Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Gus Caplan Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- lib/internal/async_hooks.js | 7 ++++++- lib/internal/policy/manifest.js | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js index d382fe36e1..165d44b702 100644 --- a/lib/internal/async_hooks.js +++ b/lib/internal/async_hooks.js @@ -4,6 +4,11 @@ const { ERR_ASYNC_TYPE, ERR_INVALID_ASYNC_ID } = require('internal/errors').codes; + +const { getOptionValue } = require('internal/options'); +const shouldAbortOnUncaughtException = + getOptionValue('--abort-on-uncaught-exception'); + const async_wrap = internalBinding('async_wrap'); /* async_hook_fields is a Uint32Array wrapping the uint32_t array of * Environment::AsyncHooks::fields_[]. Each index tracks the number of active @@ -107,7 +112,7 @@ function fatalError(e) { Error.captureStackTrace(o, fatalError); process._rawDebug(o.stack); } - if (internalBinding('config').shouldAbortOnUncaughtException) { + if (shouldAbortOnUncaughtException) { process.abort(); } process.exit(1); diff --git a/lib/internal/policy/manifest.js b/lib/internal/policy/manifest.js index f6adca125b..6c777a7c78 100644 --- a/lib/internal/policy/manifest.js +++ b/lib/internal/policy/manifest.js @@ -25,7 +25,9 @@ const { entries } = Object; const kIntegrities = new SafeWeakMap(); const kReactions = new SafeWeakMap(); const kRelativeURLStringPattern = /^\.{0,2}\//; -const { shouldAbortOnUncaughtException } = internalBinding('config'); +const { getOptionValue } = require('internal/options'); +const shouldAbortOnUncaughtException = + getOptionValue('--abort-on-uncaught-exception'); const { abort, exit, _rawDebug } = process; function REACTION_THROW(error) { -- cgit v1.2.3