Skip to content

Commit

Permalink
lib: migrate from process.binding to internalBinding
Browse files Browse the repository at this point in the history
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: #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>
  • Loading branch information
madeinjam authored and rvagg committed Nov 28, 2018
1 parent 187216e commit dfc16ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,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;
}
15 changes: 15 additions & 0 deletions test/sequential/test-inspector-has-inspector-false.js
Original file line number Diff line number Diff line change
@@ -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),
);

0 comments on commit dfc16ab

Please sign in to comment.