feature(console) Util.exec -> callback

This commit is contained in:
coderaiser 2014-08-22 07:49:33 -04:00
parent 1c770f74d0
commit 23695fb04b

View file

@ -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) {