diff --git a/lib/server/console.js b/lib/server/console.js index 3b5783e4..2e269ac5 100644 --- a/lib/server/console.js +++ b/lib/server/console.js @@ -209,19 +209,9 @@ }; } - function getSpawn(pCommand, options, callback) { - var send, cmd, error, - args = pCommand.split(' '); - - pCommand = args.shift(); - - error = Util.tryCatchLog(function() { - cmd = spawn(pCommand, args, options); - }); - - if (!cmd) - send(error + '', null); - else { + function getSpawn(сommand, options, callback) { + var cmd, error, + args = сommand.split(' '), send = function(error, data) { var exec = { stderr: error, @@ -230,7 +220,16 @@ Util.exec(callback, exec); }; - + + сommand = args.shift(); + + error = Util.tryCatchLog(function() { + cmd = spawn(сommand, args, options); + }); + + if (!cmd) + send(error + '', null); + else { cmd.stdout.on('data', function(data) { send(null, data + ''); });