child_process: do not set args before throwing

No point in setting args and options if TypeError
is being thrown.

fix #7456

Signed-off-by: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
Greg Sabia Tucker 2014-05-13 22:32:57 -07:00 committed by Fedor Indutny
parent 885142a5ed
commit 7bd08c5062

View File

@ -711,8 +711,6 @@ var spawn = exports.spawn = function(file /*, args, options*/) {
args = arguments[1].slice(0);
options = arguments[2];
} else if (arguments[1] && !Array.isArray(arguments[1])) {
args = [];
options = arguments[2];
throw new TypeError('Incorrect value of args option');
} else {
args = [];