refactor(console) getOnMessage

This commit is contained in:
coderaiser 2014-05-21 04:07:44 -04:00
parent 2e3e5c1ab7
commit a2604fdc91

View file

@ -108,8 +108,8 @@
* @param callback
*/
function getOnMessage(connNum, callback, command) {
var lWinCommand, lExec_func, firstChar,
connName, lRet, lExecSymbols, isContain,
var winCommand, symbolsExec, funcExec, firstChar,
connName, ret, isContain,
dir, options = {};
dir = ClientDirs[connNum];
@ -121,9 +121,9 @@
Util.log(connName + command);
if (equalPart(command, CLOUDCMD))
lRet = onCloudCmd(command, callback);
ret = onCloudCmd(command, callback);
else if (equalPart(command, 'cd ')) {
lRet = true;
ret = true;
onCD(command, dir, function(json) {
var error = json.stderr,
@ -136,15 +136,15 @@
});
}
if (!lRet) {
if (!ret) {
/* if we on windows and command is build in
* change code page to unicode becouse
* windows use unicode on non English versions
*/
if (WIN32) {
lWinCommand = command.toUpperCase();
winCommand = command.toUpperCase();
if (Win32Commands.indexOf(lWinCommand) >= 0)
if (Win32Commands.indexOf(winCommand) >= 0)
command = 'chcp 65001 |' + command;
}
@ -156,9 +156,9 @@
Util.exec(callback, json);
});
lExec_func = ClientFuncs[connNum];
lExecSymbols = ['*', '&', '{', '}', '|', '\'', '"'];
isContain = Util.isContainStr(command, lExecSymbols);
funcExec = ClientFuncs[connNum];
symbolsExec = ['*', '&', '{', '}', '|', '\'', '"'];
isContain = Util.isContainStr(command, symbolsExec);
firstChar = command[0];
options.cwd = dir;
@ -171,7 +171,7 @@
stdout: command
}, true);
} else if (WIN32 || firstChar === ' ' || isContain)
exec(command, options, lExec_func);
exec(command, options, funcExec);
else
setSpawn(command, options, callback);
}