refactor(console) setSpawn

This commit is contained in:
coderaiser 2014-07-02 10:26:39 -04:00
parent 2ea3cffad6
commit 10103817a1

View file

@ -180,15 +180,19 @@
isSended = false,
args = сommand.split(' '),
send = function(error, data) {
var exec = {
stderr: error,
stdout: data
};
if (!isSended)
isSended = true;
Util.exec(callback, exec);
callback({
stderr: error,
stdout: data
});
},
sendError = function(error) {
send(error, null);
if (!isSended) {
isSended = true;
send(error, null);
}
};
сommand = args.shift();
@ -205,12 +209,10 @@
cmd.stdout.on('data', function(data) {
send(null, data);
isSended = true;
});
cmd.stderr.on('data', function(data) {
sendError(data);
isSended = true;
cmd.stderr.on('data', function(error) {
sendError(error);
});
cmd.on('error', function(error) {
@ -218,7 +220,6 @@
Util.log(error);
sendError(errorStr);
isSended = true;
});
cmd.on('close', function () {