mirror of https://github.com/jumpserver/jumpserver
pull issue #120
parent
7dcf050dc4
commit
b2ccbc3f9e
|
@ -92,8 +92,8 @@ class Tty(object):
|
|||
self.remote_ip = ''
|
||||
self.login_type = login_type
|
||||
self.vim_flag = False
|
||||
self.ps1_pattern = re.compile('\[.*@.*\][\$#]\s')
|
||||
self.vim_pattern = re.compile(r'\Wvi[m]+\s.* | \Wfg\s.*', re.X)
|
||||
self.ps1_pattern = re.compile('\[?.*@.*\]?[\$#]\s')
|
||||
self.vim_pattern = re.compile(r'\W?vi[m]?\s.* | \W?fg\s.*', re.X)
|
||||
self.vim_data = ''
|
||||
self.stream = None
|
||||
self.screen = None
|
||||
|
@ -141,6 +141,7 @@ class Tty(object):
|
|||
:return:返回最后的处理结果
|
||||
"""
|
||||
command = ''
|
||||
try:
|
||||
self.stream.feed(data)
|
||||
# 从虚拟屏幕中获取处理后的数据
|
||||
for line in reversed(self.screen.buffer):
|
||||
|
@ -160,6 +161,8 @@ class Tty(object):
|
|||
self.vim_flag = True
|
||||
# 虚拟屏幕清空
|
||||
self.screen.reset()
|
||||
except Exception:
|
||||
pass
|
||||
return command
|
||||
|
||||
def get_log(self):
|
||||
|
|
Loading…
Reference in New Issue