Skip to content

Commit 56e7e4f

Browse files
cjihrigtargos
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 <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 7e2ae75 commit 56e7e4f

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);
@@ -534,11 +534,11 @@ function normalizeSpawnArguments(file, args, options) {
534534
}
535535

536536

537-
var spawn = exports.spawn = function spawn(/* file, args, options */) {
538-
var opts = normalizeSpawnArguments.apply(null, arguments);
539-
var options = opts.options;
540-
var child = new ChildProcess();
537+
var spawn = exports.spawn = function spawn(file, args, options) {
538+
const opts = normalizeSpawnArguments(file, args, options);
539+
const child = new ChildProcess();
541540

541+
options = opts.options;
542542
debug('spawn', opts.args, options);
543543

544544
child.spawn({
@@ -557,10 +557,10 @@ var spawn = exports.spawn = function spawn(/* file, args, options */) {
557557
return child;
558558
};
559559

560-
function spawnSync(/* file, args, options */) {
561-
var opts = normalizeSpawnArguments.apply(null, arguments);
560+
function spawnSync(file, args, options) {
561+
const opts = normalizeSpawnArguments(file, args, options);
562562

563-
var options = opts.options;
563+
options = opts.options;
564564

565565
debug('spawnSync', opts.args, options);
566566

@@ -628,8 +628,8 @@ function checkExecSyncError(ret, args, cmd) {
628628
}
629629

630630

631-
function execFileSync(/* command, args, options */) {
632-
var opts = normalizeSpawnArguments.apply(null, arguments);
631+
function execFileSync(command, args, options) {
632+
var opts = normalizeSpawnArguments(command, args, options);
633633
var inheritStderr = !opts.options.stdio;
634634

635635
var ret = spawnSync(opts.file, opts.args.slice(1), opts.options);
@@ -647,8 +647,8 @@ function execFileSync(/* command, args, options */) {
647647
exports.execFileSync = execFileSync;
648648

649649

650-
function execSync(command /* , options */) {
651-
var opts = normalizeExecArgs.apply(null, arguments);
650+
function execSync(command, options) {
651+
var opts = normalizeExecArgs(command, options, null);
652652
var inheritStderr = !opts.options.stdio;
653653

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

0 commit comments

Comments
 (0)