Skip to content

Commit

Permalink
lib: refactor setupInspector in bootstrap/node.js
Browse files Browse the repository at this point in the history
`CJSModule` is not used in `setupGlobalConsole`, so we can move it to
`setupInspector` and remove the argument from `setupInspector`.

PR-URL: #24446
Reviewed-By: Ouyang Yadong <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
  • Loading branch information
leeight authored and codebytere committed Jan 13, 2019
1 parent ef15907 commit 522a6ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@

function setupGlobalConsole() {
const originalConsole = global.console;
const CJSModule = NativeModule.require('internal/modules/cjs/loader');
// Setup Node.js global.console.
const wrappedConsole = NativeModule.require('console');
Object.defineProperty(global, 'console', {
Expand All @@ -412,7 +411,7 @@
value: wrappedConsole,
writable: true
});
setupInspector(originalConsole, wrappedConsole, CJSModule);
setupInspector(originalConsole, wrappedConsole);
}

function setupGlobalURL() {
Expand All @@ -438,10 +437,11 @@
NativeModule.require('internal/domexception');
}

function setupInspector(originalConsole, wrappedConsole, CJSModule) {
function setupInspector(originalConsole, wrappedConsole) {
if (!process.config.variables.v8_enable_inspector) {
return;
}
const CJSModule = NativeModule.require('internal/modules/cjs/loader');
const { addCommandLineAPI, consoleCall } = process.binding('inspector');
// Setup inspector command line API.
const { makeRequireFunction } =
Expand Down

0 comments on commit 522a6ed

Please sign in to comment.