From 79f03880e31861d41353b0dab50fcf3b899f7858 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 11 Jul 2013 07:16:58 +0000 Subject: [PATCH] chore(socket) add 'cloudcmd' -> CLOUDCMD --- lib/server/socket.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/server/socket.js b/lib/server/socket.js index da3b4d79..400d454c 100644 --- a/lib/server/socket.js +++ b/lib/server/socket.js @@ -10,6 +10,8 @@ update = main.srvrequire('update'), exec = main.child_process.exec, Util = main.util, + mainpackage = main.mainpackage, + CLOUDCMD = mainpackage.name, ClientFuncs = [], OnMessageFuncs = [], @@ -97,8 +99,8 @@ Util.log('#' + pConnNum + ': ' + pCommand); - if( Util.isContainStrAtBegin(pCommand, 'cloudcmd') ){ - pCommand = Util.removeStr(pCommand, 'cloudcmd'); + if( Util.isContainStrAtBegin(pCommand, CLOUDCMD) ) { + pCommand = Util.removeStr(pCommand, CLOUDCMD); if( Util.isContainStrAtBegin(pCommand, ' ') ){ pCommand = Util.removeStr(pCommand, ' '); @@ -114,8 +116,8 @@ } else { lMsg = { - stdout : 'cloudcmd exit \n' + - 'cloudcmd update \n', + stdout : CLOUDCMD + ' exit \n' + + CLOUDCMD + ' update \n', stderr : null }; @@ -125,6 +127,8 @@ Util.log('received from client: ' + pCommand); Util.log('sended to client: ' + lMsg); } + } else if( Util.isContainStrAtBegin(pCommand, 'cd ') ) { + pCommand = Util.removeStr(pCommand, 'cd '); } /* if we on windows and command is build in