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 <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
09a5f0252e
commit
b44131ab92
@ -4,6 +4,11 @@ const {
|
|||||||
ERR_ASYNC_TYPE,
|
ERR_ASYNC_TYPE,
|
||||||
ERR_INVALID_ASYNC_ID
|
ERR_INVALID_ASYNC_ID
|
||||||
} = require('internal/errors').codes;
|
} = require('internal/errors').codes;
|
||||||
|
|
||||||
|
const { getOptionValue } = require('internal/options');
|
||||||
|
const shouldAbortOnUncaughtException =
|
||||||
|
getOptionValue('--abort-on-uncaught-exception');
|
||||||
|
|
||||||
const async_wrap = internalBinding('async_wrap');
|
const async_wrap = internalBinding('async_wrap');
|
||||||
/* async_hook_fields is a Uint32Array wrapping the uint32_t array of
|
/* async_hook_fields is a Uint32Array wrapping the uint32_t array of
|
||||||
* Environment::AsyncHooks::fields_[]. Each index tracks the number of active
|
* Environment::AsyncHooks::fields_[]. Each index tracks the number of active
|
||||||
@ -107,7 +112,7 @@ function fatalError(e) {
|
|||||||
Error.captureStackTrace(o, fatalError);
|
Error.captureStackTrace(o, fatalError);
|
||||||
process._rawDebug(o.stack);
|
process._rawDebug(o.stack);
|
||||||
}
|
}
|
||||||
if (internalBinding('config').shouldAbortOnUncaughtException) {
|
if (shouldAbortOnUncaughtException) {
|
||||||
process.abort();
|
process.abort();
|
||||||
}
|
}
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
@ -25,7 +25,9 @@ const { entries } = Object;
|
|||||||
const kIntegrities = new SafeWeakMap();
|
const kIntegrities = new SafeWeakMap();
|
||||||
const kReactions = new SafeWeakMap();
|
const kReactions = new SafeWeakMap();
|
||||||
const kRelativeURLStringPattern = /^\.{0,2}\//;
|
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;
|
const { abort, exit, _rawDebug } = process;
|
||||||
|
|
||||||
function REACTION_THROW(error) {
|
function REACTION_THROW(error) {
|
||||||
|
@ -69,9 +69,6 @@ static void Initialize(Local<Object> target,
|
|||||||
READONLY_FALSE_PROPERTY(target, "hasInspector");
|
READONLY_FALSE_PROPERTY(target, "hasInspector");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (env->abort_on_uncaught_exception())
|
|
||||||
READONLY_TRUE_PROPERTY(target, "shouldAbortOnUncaughtException");
|
|
||||||
|
|
||||||
READONLY_PROPERTY(target,
|
READONLY_PROPERTY(target,
|
||||||
"bits",
|
"bits",
|
||||||
Number::New(env->isolate(), 8 * sizeof(intptr_t)));
|
Number::New(env->isolate(), 8 * sizeof(intptr_t)));
|
||||||
|
@ -540,7 +540,14 @@ void GetOptions(const FunctionCallbackInfo<Value>& args) {
|
|||||||
switch (option_info.type) {
|
switch (option_info.type) {
|
||||||
case kNoOp:
|
case kNoOp:
|
||||||
case kV8Option:
|
case kV8Option:
|
||||||
value = Undefined(isolate);
|
// Special case for --abort-on-uncaught-exception which is also
|
||||||
|
// respected by Node.js internals
|
||||||
|
if (item.first == "--abort-on-uncaught-exception") {
|
||||||
|
value = Boolean::New(
|
||||||
|
isolate, original_per_env->abort_on_uncaught_exception);
|
||||||
|
} else {
|
||||||
|
value = Undefined(isolate);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case kBoolean:
|
case kBoolean:
|
||||||
value = Boolean::New(isolate, *parser.Lookup<bool>(field, opts));
|
value = Boolean::New(isolate, *parser.Lookup<bool>(field, opts));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user