Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions lib/internal/bootstrap/node.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,8 @@
const { internalBinding, NativeModule } = loaderExports;

const exceptionHandlerState = { captureFn: null };
let getOptionValue;
const { getOptionValue } = NativeModule.require('internal/options');


function startup() {
setupTraceCategoryState();
Expand DownExpand Up@@ -149,18 +150,6 @@ function startup() {
NativeModule.require('internal/inspector_async_hook').setup();
}

getOptionValue = NativeModule.require('internal/options').getOptionValue;

if (getOptionValue('--help')) {
NativeModule.require('internal/print_help').print(process.stdout);
return;
}

if (getOptionValue('--completion-bash')) {
NativeModule.require('internal/bash_completion').print(process.stdout);
return;
}

// If the process is spawned with env NODE_CHANNEL_FD, it's probably
// spawned by our child_process module, then initialize IPC.
// This attaches some internal event listeners and creates:
Expand DownExpand Up@@ -317,6 +306,18 @@ function startExecution() {
return;
}

// node --help
if (getOptionValue('--help')) {
NativeModule.require('internal/print_help').print(process.stdout);
return;
}

// e.g. node --completion-bash >> ~/.bashrc
if (getOptionValue('--completion-bash')) {
NativeModule.require('internal/bash_completion').print(process.stdout);
return;
}

// `node --prof-process`
if (getOptionValue('--prof-process')) {
NativeModule.require('internal/v8_prof_processor');
Expand Down