mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
feature(terminal) add info if pty not installed
This commit is contained in:
parent
4e8c524dcb
commit
a507c32f4c
1 changed files with 19 additions and 6 deletions
|
|
@ -20,20 +20,33 @@
|
|||
CHANNEL = CloudFunc.CHANNEL_TERMINAL,
|
||||
CHANNEL_RESIZE = CloudFunc.CHANNEL_TERMINAL_RESIZE,
|
||||
|
||||
ConNum = 0;
|
||||
ConNum = 0,
|
||||
|
||||
INFO = 'to use terminal install pty.js: npm i pty.js';
|
||||
|
||||
/**
|
||||
* function listen on servers port
|
||||
* @pServer {Object} started server object
|
||||
*/
|
||||
exports.init = function() {
|
||||
var ret;
|
||||
|
||||
if (pty)
|
||||
ret = socket.on('connection', function(clientSocket) {
|
||||
var ret, func,
|
||||
makePty = function(clientSocket) {
|
||||
onConnection(clientSocket, function(channel, data) {
|
||||
socket.emit(channel, data, clientSocket);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
sendInfo = function(clientSocket) {
|
||||
Util.log(INFO);
|
||||
socket.emit(CHANNEL, INFO, clientSocket);
|
||||
};
|
||||
|
||||
if (pty)
|
||||
func = makePty;
|
||||
else
|
||||
func = sendInfo;
|
||||
|
||||
ret = socket.on('connection', func);
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue