diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2017-04-05 14:06:52 -0700 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2017-08-15 20:57:20 -0700 |
commit | 547e74bb22a0e5f0adbbec006250337c581f9bbf (patch) | |
tree | f6408714d55f9992fa4a1093d13ebcc2cc78c1e1 /lib | |
parent | f9e427945bbcfc43aafbbfa7addeb1a59d388ee8 (diff) | |
download | node-new-547e74bb22a0e5f0adbbec006250337c581f9bbf.tar.gz |
src: use option parser for expose_internals
bootstrap_node.js was directly parsing process.execArgv to see if
internals should be exposed, even though the argv was already parsed by
node. This is unusual and unnecessary, change it to set the option value
from the parser onto the config binding.
Backport-PR-URL: https://github.com/nodejs/node/pull/14483
PR-URL: https://github.com/nodejs/node/pull/12245
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/bootstrap_node.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 55dd4057ac..de215dc2dc 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -443,11 +443,9 @@ return NativeModule._source.hasOwnProperty(id); }; - const EXPOSE_INTERNALS = process.execArgv.some(function(arg) { - return arg.match(/^--expose[-_]internals$/); - }); + const config = process.binding('config'); - if (EXPOSE_INTERNALS) { + if (config.exposeInternals) { NativeModule.nonInternalExists = NativeModule.exists; NativeModule.isInternal = function(id) { |