mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
fix(socket) getSpawn: add tryCachLog
This commit is contained in:
parent
778324be9a
commit
82f432b06f
1 changed files with 23 additions and 18 deletions
|
|
@ -240,26 +240,31 @@
|
|||
pCommand = args.shift();
|
||||
|
||||
spawn = main.child_process.spawn;
|
||||
cmd = spawn(pCommand, args, options);
|
||||
send = function(data, isError) {
|
||||
var lExec = {},
|
||||
msg = data.toString();
|
||||
|
||||
if (isError)
|
||||
lExec.stderr = msg;
|
||||
else
|
||||
lExec.stdout = msg;
|
||||
|
||||
Util.exec(callback, lExec);
|
||||
};
|
||||
|
||||
cmd.stdout.on('data', send);
|
||||
|
||||
cmd.stderr.on('data', function(data) {
|
||||
send(data, true);
|
||||
Util.tryCatchLog(function() {
|
||||
cmd = spawn(pCommand, args, options);
|
||||
});
|
||||
|
||||
cmd.on('error', Util.retFalse);
|
||||
if (cmd) {
|
||||
send = function(data, isError) {
|
||||
var lExec = {},
|
||||
msg = data.toString();
|
||||
|
||||
if (isError)
|
||||
lExec.stderr = msg;
|
||||
else
|
||||
lExec.stdout = msg;
|
||||
|
||||
Util.exec(callback, lExec);
|
||||
};
|
||||
|
||||
cmd.stdout.on('data', send);
|
||||
|
||||
cmd.stderr.on('data', function(data) {
|
||||
send(data, true);
|
||||
});
|
||||
|
||||
cmd.on('error', Util.retFalse);
|
||||
}
|
||||
}
|
||||
|
||||
function onCloudCmd(pCommand, callback) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue