Skip to content

Commit

Permalink
child_process: inlines arg normalization in the fork function itself.
Browse files Browse the repository at this point in the history
refs: #20749
  • Loading branch information
shobhitchittora committed Aug 20, 2018
1 parent 37d6019 commit 529480e
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ function stdioStringToArray(option) {
}
}

function normalizeForkArguments(args, options) {
exports.fork = function fork(modulePath /* , args, options */) {
// Get options and args arguments.
var execArgv;

var args = arguments[1];
var options = arguments[2];

if (Array.isArray(args)) {
args = args.slice(0);
} else if (options !== undefined &&
Expand All @@ -78,20 +84,6 @@ function normalizeForkArguments(args, options) {
throw new ERR_INVALID_ARG_VALUE('options', 'object', options);
}

return {
args,
options
};
}

exports.fork = function fork(modulePath /* , args, options */) {

// Get options and args arguments.
var execArgv;
var opts = normalizeForkArguments(arguments[1], arguments[2]);
var options = opts.options;
var args = opts.args;

// Prepare arguments for fork:
execArgv = options.execArgv || process.execArgv;

Expand Down

0 comments on commit 529480e

Please sign in to comment.