mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-28 10:14:13 +00:00
minor changes
This commit is contained in:
parent
8f49be8332
commit
e2844cdb80
2 changed files with 34 additions and 6 deletions
|
|
@ -1,7 +1,9 @@
|
|||
/* module make possible connectoin thrue socket.io on a server */
|
||||
|
||||
var io = require('socket.io'),
|
||||
exec = require('child_process').exec,
|
||||
var LIBDIRSERVER = './lib/server/',
|
||||
io = require('socket.io'),
|
||||
exec = require('child_process').exec,
|
||||
update = cloudRequire(LIBDIRSERVER + 'update'),
|
||||
ClientFuncs = [],
|
||||
OnMessageFuncs = [],
|
||||
Win32_b = process.platform === 'win32';
|
||||
|
|
@ -44,8 +46,16 @@ function onMessage(pConnNum, pSocket){
|
|||
if( pCommand.indexOf('cloudcmd') === 0 ){
|
||||
pCommand = pCommand.replace('cloudcmd', '');
|
||||
|
||||
if(pCommand.indexOf(' exit') === 0){
|
||||
pCommand = 'kill -9 ' + process.pid;
|
||||
if(pCommand.indexOf(' ') === 0){
|
||||
pCommand = pCommand.replace(' ','');
|
||||
|
||||
if(pCommand.indexOf('update') === 0){
|
||||
if(update)
|
||||
update.get();
|
||||
}
|
||||
|
||||
if(pCommand.indexOf('exit') === 0)
|
||||
pCommand = 'kill -9 ' + process.pid;
|
||||
}
|
||||
else {
|
||||
var lMsg = {
|
||||
|
|
@ -118,4 +128,17 @@ var Win32Commands = ['ASSOC', 'AT', 'ATTRIB', 'BREAK', 'CACLS', 'CALL',
|
|||
'PUSHD', 'RD', 'RECOVER', 'REM', 'REN', 'RENAME',
|
||||
'REPLACE', 'RMDIR', 'SET', 'SETLOCAL', 'SHIFT', 'SORT',
|
||||
'START', 'SUBST', 'TIME', 'TITLE', 'TREE', 'TYPE',
|
||||
'VER', 'VERIFY', 'VOL', 'XCOPY'];
|
||||
'VER', 'VERIFY', 'VOL', 'XCOPY'];
|
||||
|
||||
/**
|
||||
* function do safe require of needed module
|
||||
* @param pModule
|
||||
*/
|
||||
function cloudRequire(pModule){
|
||||
try{
|
||||
return require(pModule);
|
||||
}
|
||||
catch(pError){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue