Skip to content

Commit acb49dc

Browse files
committed
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 7a867b8 commit acb49dc

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);
@@ -537,11 +537,11 @@ function normalizeSpawnArguments(file, args, options) {
537537
}
538538

539539

540-
var spawn = exports.spawn = function spawn(/* file, args, options */) {
541-
var opts = normalizeSpawnArguments.apply(null, arguments);
542-
var options = opts.options;
543-
var child = new ChildProcess();
540+
var spawn = exports.spawn = function spawn(file, args, options) {
541+
const opts = normalizeSpawnArguments(file, args, options);
542+
const child = new ChildProcess();
544543

544+
options = opts.options;
545545
debug('spawn', opts.args, options);
546546

547547
child.spawn({
@@ -560,10 +560,10 @@ var spawn = exports.spawn = function spawn(/* file, args, options */) {
560560
return child;
561561
};
562562

563-
function spawnSync(/* file, args, options */) {
564-
var opts = normalizeSpawnArguments.apply(null, arguments);
563+
function spawnSync(file, args, options) {
564+
const opts = normalizeSpawnArguments(file, args, options);
565565

566-
var options = opts.options;
566+
options = opts.options;
567567

568568
debug('spawnSync', opts.args, options);
569569

@@ -631,8 +631,8 @@ function checkExecSyncError(ret, args, cmd) {
631631
}
632632

633633

634-
function execFileSync(/* command, args, options */) {
635-
var opts = normalizeSpawnArguments.apply(null, arguments);
634+
function execFileSync(command, args, options) {
635+
var opts = normalizeSpawnArguments(command, args, options);
636636
var inheritStderr = !opts.options.stdio;
637637

638638
var ret = spawnSync(opts.file, opts.args.slice(1), opts.options);
@@ -650,8 +650,8 @@ function execFileSync(/* command, args, options */) {
650650
exports.execFileSync = execFileSync;
651651

652652

653-
function execSync(command /* , options */) {
654-
var opts = normalizeExecArgs.apply(null, arguments);
653+
function execSync(command, options) {
654+
var opts = normalizeExecArgs(command, options, null);
655655
var inheritStderr = !opts.options.stdio;
656656

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

0 commit comments

Comments
 (0)