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 codebytere committed Jan 29, 2019
1 parent 164069c commit 6bd055f
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 6bd055f

Please sign in to comment.