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 authored and Fedor Indutny committed 2014-05-16 01:31:59 +04:00
1 parent 885142a5ed
commit 7bd08c5062
1 file changed
-2
-2
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 = [];