mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(console) setSpawn: always send result
This commit is contained in:
parent
314fcca806
commit
e97f5e94eb
1 changed files with 10 additions and 1 deletions
|
|
@ -177,6 +177,7 @@
|
|||
|
||||
function setSpawn(сommand, options, callback) {
|
||||
var cmd, error,
|
||||
isSended = false,
|
||||
args = сommand.split(' '),
|
||||
send = function(error, data) {
|
||||
var exec = {
|
||||
|
|
@ -204,19 +205,27 @@
|
|||
|
||||
cmd.stdout.on('data', function(data) {
|
||||
send(null, data);
|
||||
isSended = true;
|
||||
});
|
||||
|
||||
cmd.stderr.on('data', sendError);
|
||||
cmd.stderr.on('data', function(data) {
|
||||
sendError(data);
|
||||
isSended = true;
|
||||
});
|
||||
|
||||
cmd.on('error', function(error) {
|
||||
var errorStr = addNewLine(error + '');
|
||||
|
||||
Util.log(error);
|
||||
sendError(errorStr);
|
||||
isSended = true;
|
||||
});
|
||||
|
||||
cmd.on('close', function () {
|
||||
cmd = null;
|
||||
|
||||
if (!isSended)
|
||||
send(null, null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue