lib: migrate from process.binding to internalBinding

We are migrating towards using internalBinding(\'options\').getOptions()
instead of process.binding(\'config\') to access the value of the
--experimental-vm-modules command line option.

PR-URL: https://github.com/nodejs/node/pull/23586
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
Andres Monge 2018-10-12 09:41:57 -07:00 committed by Rich Trott
parent 401dac324c
commit 9d1c9d7e9b
2 changed files with 16 additions and 1 deletions

View File

@ -415,7 +415,7 @@ module.exports = {
compileFunction,
};
if (process.binding('config').experimentalVMModules) {
if (internalBinding('options').getOptions('--experimental-vm-modules')) {
const { SourceTextModule } = require('internal/vm/source_text_module');
module.exports.SourceTextModule = SourceTextModule;
}

View File

@ -0,0 +1,15 @@
// Flags: --expose-internals
'use strict';
const common = require('../common');
// This is to ensure that the sendInspectorCommand function calls the error
// function if its called with the v8_enable_inspector is disabled
process.config.variables.v8_enable_inspector = 0;
const inspector = require('internal/util/inspector');
inspector.sendInspectorCommand(
common.mustNotCall('Inspector callback should not be called'),
common.mustCall(1),
);