mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +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;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,11 @@
|
|||
var exec = require('child_process').exec,
|
||||
packagejson = cloudRequire('package.json');
|
||||
|
||||
exports.get = function(){
|
||||
/**
|
||||
* function gets update
|
||||
* @param pCallBack
|
||||
*/
|
||||
exports.get = function(pCallBack){
|
||||
exec('git pull', pull);
|
||||
};
|
||||
|
||||
|
|
@ -21,6 +25,7 @@ function pull(pError, pStdout, pStderr){
|
|||
}
|
||||
else pStdout = 'Cloud Commander is up to date.';
|
||||
|
||||
console.log(packagejson);
|
||||
if(packagejson)
|
||||
pStdout = 'Version ' + packagejson.version + '\n' + pStdout;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue