mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 02:29:23 +00:00
refactor(console) getOnMessage
This commit is contained in:
parent
2e3e5c1ab7
commit
a2604fdc91
1 changed files with 11 additions and 11 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue