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: nodejs#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 danbev committed Nov 20, 2018
1 parent 47495e0 commit 771585f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/bootstrap/node.js
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 771585f

Please sign in to comment.