diff options
author | Jon Moss <me@jonathanmoss.me> | 2017-12-21 18:45:36 -0500 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2017-12-23 22:20:30 -0500 |
commit | 1dd9c826e0f6b9d6b4df84486165e5d3aefbc348 (patch) | |
tree | 7ba12c889d5354037246c93ee973f67e3d1cda21 /lib | |
parent | 210c761d83d29a712afea392163cff719f237a7a (diff) | |
download | android-node-v8-1dd9c826e0f6b9d6b4df84486165e5d3aefbc348.tar.gz android-node-v8-1dd9c826e0f6b9d6b4df84486165e5d3aefbc348.tar.bz2 android-node-v8-1dd9c826e0f6b9d6b4df84486165e5d3aefbc348.zip |
lib, src: use process.config instead of regex
Is safer to use a `process.binding(config)` defined boolean, than to
regex on `process.execArgv`. Also, this better falls in line with the
conventions of checking flags passed to the executable.
PR-URL: https://github.com/nodejs/node/pull/17814
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/async_hooks.js | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js index 4bd5f3191b..035dd0634d 100644 --- a/lib/internal/async_hooks.js +++ b/lib/internal/async_hooks.js @@ -75,9 +75,6 @@ const emitDestroyNative = emitHookFactory(destroy_symbol, 'emitDestroyNative'); const emitPromiseResolveNative = emitHookFactory(promise_resolve_symbol, 'emitPromiseResolveNative'); -// TODO(refack): move to node-config.cc -const abort_regex = /^--abort[_-]on[_-]uncaught[_-]exception$/; - // Setup the callbacks that node::AsyncWrap will call when there are hooks to // process. They use the same functions as the JS embedder API. These callbacks // are setup immediately to prevent async_wrap.setupHooks() from being hijacked @@ -97,7 +94,7 @@ function fatalError(e) { Error.captureStackTrace(o, fatalError); process._rawDebug(o.stack); } - if (process.execArgv.some((e) => abort_regex.test(e))) { + if (process.binding('config').shouldAbortOnUncaughtException) { process.abort(); } process.exit(1); |