Skip to content

Commit 1f57273

Browse files
cjihrigBethGriggs
authored andcommitted
child_process: simplify argument handling
This commit simplifies the calling of normalizeSpawnArguments() and normalizeExecArguments(). Specifically, this commit replaces apply() and the use of arguments with a normal function call. PR-URL: #25194 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent b8efc9d commit 1f57273

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

lib/child_process.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ function normalizeExecArgs(command, options, callback) {
147147
}
148148

149149

150-
exports.exec = function exec(/* command , options, callback */) {
151-
const opts = normalizeExecArgs.apply(null, arguments);
150+
exports.exec = function exec(command, options, callback) {
151+
const opts = normalizeExecArgs(command, options, callback);
152152
return exports.execFile(opts.file,
153153
opts.options,
154154
opts.callback);
@@ -529,11 +529,11 @@ function normalizeSpawnArguments(file, args, options) {
529529
}
530530

531531

532-
var spawn = exports.spawn = function spawn(/* file, args, options */) {
533-
var opts = normalizeSpawnArguments.apply(null, arguments);
534-
var options = opts.options;
535-
var child = new ChildProcess();
532+
var spawn = exports.spawn = function spawn(file, args, options) {
533+
const opts = normalizeSpawnArguments(file, args, options);
534+
const child = new ChildProcess();
536535

536+
options = opts.options;
537537
debug('spawn', opts.args, options);
538538

539539
child.spawn({
@@ -552,10 +552,10 @@ var spawn = exports.spawn = function spawn(/* file, args, options */) {
552552
return child;
553553
};
554554

555-
function spawnSync(/* file, args, options */) {
556-
var opts = normalizeSpawnArguments.apply(null, arguments);
555+
function spawnSync(file, args, options) {
556+
const opts = normalizeSpawnArguments(file, args, options);
557557

558-
var options = opts.options;
558+
options = opts.options;
559559

560560
debug('spawnSync', opts.args, options);
561561

@@ -623,8 +623,8 @@ function checkExecSyncError(ret, args, cmd) {
623623
}
624624

625625

626-
function execFileSync(/* command, args, options */) {
627-
var opts = normalizeSpawnArguments.apply(null, arguments);
626+
function execFileSync(command, args, options) {
627+
var opts = normalizeSpawnArguments(command, args, options);
628628
var inheritStderr = !opts.options.stdio;
629629

630630
var ret = spawnSync(opts.file, opts.args.slice(1), opts.options);
@@ -642,8 +642,8 @@ function execFileSync(/* command, args, options */) {
642642
exports.execFileSync = execFileSync;
643643

644644

645-
function execSync(command /* , options */) {
646-
var opts = normalizeExecArgs.apply(null, arguments);
645+
function execSync(command, options) {
646+
var opts = normalizeExecArgs(command, options, null);
647647
var inheritStderr = !opts.options.stdio;
648648

649649
var ret = spawnSync(opts.file, opts.options);

0 commit comments

Comments
 (0)