mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 01:47:35 +00:00
feature(console) Util.exec -> callback
This commit is contained in:
parent
1c770f74d0
commit
23695fb04b
1 changed files with 6 additions and 4 deletions
|
|
@ -122,6 +122,8 @@
|
|||
cwd: dir || CWD
|
||||
};
|
||||
|
||||
Util.checkArgs(arguments, ['callback', 'command']);
|
||||
|
||||
if (!dir)
|
||||
dir = ClientDirs[connNum] = CWD;
|
||||
|
||||
|
|
@ -150,11 +152,11 @@
|
|||
command = 'cmd /C ' + command;
|
||||
|
||||
if (!ClientFuncs[connNum])
|
||||
ClientFuncs[connNum] = Util.exec.with(setExec, function(json, error, stderr) {
|
||||
ClientFuncs[connNum] = setExec.bind(null, function(json, error, stderr) {
|
||||
log(connNum, error, 'error');
|
||||
log(connNum, stderr, 'stderror');
|
||||
|
||||
Util.exec(callback, json);
|
||||
callback(json);
|
||||
});
|
||||
|
||||
funcExec = ClientFuncs[connNum];
|
||||
|
|
@ -182,7 +184,7 @@
|
|||
function setExec(callback, error, stdout, stderr) {
|
||||
var json,
|
||||
errorStr = '';
|
||||
|
||||
|
||||
if (stderr)
|
||||
errorStr = stderr;
|
||||
else if (error)
|
||||
|
|
@ -193,7 +195,7 @@
|
|||
stderr : errorStr
|
||||
};
|
||||
|
||||
Util.exec(callback, json, error, stderr);
|
||||
callback(json, error, stderr);
|
||||
}
|
||||
|
||||
function setSpawn(сommand, options, callback) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue