Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process: move --help and --bash-completeion handling to startExecution #25262

Closed
wants to merge 1 commit into from
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 number Diff line number Diff 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 Down Expand 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 Down Expand 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