bugfix
This commit is contained in:
parent
d60505e355
commit
cc76182a35
@ -19,10 +19,16 @@ class XtermProcessor(PythonScriptProcessor):
|
||||
async def ws_2_process(self, ws):
|
||||
async for msg in ws:
|
||||
if msg.type == aiohttp.WSMsgType.TEXT:
|
||||
if msg.data == '_#_heartbeat_#_':
|
||||
await ws_send(ws, '_#_heartbeat_#_')
|
||||
else:
|
||||
self.p_obj.stdin.write(msg.data)
|
||||
resize_pattern = '_#_resize_#_'
|
||||
heartbeat_pattern = '_#_heartbeat_#_'
|
||||
if msg.data.startswith(resize_pattern):
|
||||
row, col = [ int(i) for i in msg.data[len(resize_pattern):].split(',')]
|
||||
await self.p_obj.set_terminal_size(row, col)
|
||||
continue
|
||||
if msg.data == heartbeat_pattern:
|
||||
await ws_send(ws, heartbeat_pattern)
|
||||
continue
|
||||
self.p_obj.stdin.write(msg.data)
|
||||
elif msg.type == aiohttp.WSMsgType.ERROR:
|
||||
# print('ws connection closed with exception %s' % ws.exception())
|
||||
return
|
||||
@ -61,6 +67,7 @@ class XtermProcessor(PythonScriptProcessor):
|
||||
# id = lenv['params_kw'].get('termid')
|
||||
host = login_info['host']
|
||||
port = login_info.get('port', 22)
|
||||
commandline = login_info.get('commandline', 'bash')
|
||||
username = login_info.get('username', 'root')
|
||||
password = login_info.get('password',None)
|
||||
jumpers = login_info.get('jumpers', [])
|
||||
@ -69,9 +76,9 @@ class XtermProcessor(PythonScriptProcessor):
|
||||
port=port,
|
||||
jumpers=jumpers)
|
||||
await self.sshnode.connect()
|
||||
self.p_obj = await self.sshnode._process('bash',
|
||||
term_type='vt100',
|
||||
term_size=(80, 24),
|
||||
self.p_obj = await self.sshnode._process(commandline,
|
||||
term_type='xterm-256color',
|
||||
term_size=(24, 80),
|
||||
encoding='utf-8')
|
||||
self.running = True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user