Skip to content

Commit

Permalink
child_process: spawn fast path
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Feb 24, 2025
1 parent 649da3b commit 31663cf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,20 @@ function abortChildProcess(child, killSignal, reason) {
* @returns {ChildProcess}
*/
function spawn(file, args, options) {
if (options == null && Array.isArray(args) && typeof file === 'string' && !file.includes('\u0000')) {

Check failure on line 746 in lib/child_process.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Use `const { ArrayIsArray } = primordials;` instead of the global
const child = new ChildProcess();
options = {
args,
detached: false,
file,
windowsHide: false,
windowsVerbatimArguments: false,
};
debug('spawn', options);
child.spawn(options);
return child;
}

options = normalizeSpawnArguments(file, args, options);
validateTimeout(options.timeout);
validateAbortSignal(options.signal, 'options.signal');
Expand Down

0 comments on commit 31663cf

Please sign in to comment.