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 <oyydoibh@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
  • Loading branch information
leeight authored and rvagg committed Nov 28, 2018
1 parent 3bfa953 commit e14abfe
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 @@ -439,7 +439,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 @@ -448,7 +447,7 @@
value: wrappedConsole,
writable: true
});
setupInspector(originalConsole, wrappedConsole, CJSModule);
setupInspector(originalConsole, wrappedConsole);
}

function setupGlobalURL() {
Expand Down Expand Up @@ -521,10 +520,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 e14abfe

Please sign in to comment.