Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ changes:
* `env` {Object} Environment key-value pairs. **Default:** `process.env`.
* `argv0` {string} Explicitly set the value of `argv[0]` sent to the child
process. This will be set to `command` if not specified.
* `execArgv` {string\[]} List of string arguments passed to the executable.
* `stdio` {Array|string} Child's stdio configuration (see
[`options.stdio`][`stdio`]).
* `detached` {boolean} Prepare child process to run independently of
Expand Down
8 changes: 8 additions & 0 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,13 @@ function normalizeSpawnArguments(file, args, options) {
}
}

// Handle execArgv - prepend to args if provided
if (options.execArgv != null) {
validateArray(options.execArgv, 'options.execArgv');
validateArgumentsNullCheck(options.execArgv, 'options.execArgv');
args = [...options.execArgv, ...args];
}

if (typeof options.argv0 === 'string') {
ArrayPrototypeUnshift(args, options.argv0);
} else {
Expand Down Expand Up @@ -788,6 +795,7 @@ function abortChildProcess(child, killSignal, reason) {
* cwd?: string | URL;
* env?: Record<string, string>;
* argv0?: string;
* execArgv?: string[];
* stdio?: Array | string;
* detached?: boolean;
* uid?: number;
Expand Down
Loading