★ wanayoo — archive 1999 https://github.com/nodejs/node/pull/25862/filesNouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: use `internal/options` to query `--abort-on-uncaught-exception` #25862

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+17 −6
Diff settings

Always

Just for now

@@ -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);
@@ -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) {
@@ -69,9 +69,6 @@ static void Initialize(Local<Object> target,
READONLY_FALSE_PROPERTY(target, "hasInspector");
#endif

if (env->abort_on_uncaught_exception())
READONLY_TRUE_PROPERTY(target, "shouldAbortOnUncaughtException");

READONLY_PROPERTY(target,
"bits",
Number::New(env->isolate(), 8 * sizeof(intptr_t)));
@@ -540,7 +540,14 @@ void GetOptions(const FunctionCallbackInfo<Value>& args) {
switch (option_info.type) {
case kNoOp:
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;
case kBoolean:
value = Boolean::New(isolate, *parser.Lookup<bool>(field, opts));
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.