fix(console) getSpawn: mv send up

This commit is contained in:
coderaiser 2014-04-01 07:46:30 -04:00
parent ccd78ede68
commit ae5e7ea2ab

View file

@ -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 + '');
});