Commit 641b72f3 authored by guanghongwei's avatar guanghongwei

修改 foo.setwinsize()

parent 63065f5c
...@@ -62,7 +62,10 @@ class PyCrypt(object): ...@@ -62,7 +62,10 @@ class PyCrypt(object):
def sigwinch_passthrough(sig, data): def sigwinch_passthrough(sig, data):
"""This function use to set the window size of the terminal!""" """This function use to set the window size of the terminal!"""
winsize = getwinsize() winsize = getwinsize()
try:
foo.setwinsize(winsize[0], winsize[1]) foo.setwinsize(winsize[0], winsize[1])
except:
pass
def getwinsize(): def getwinsize():
...@@ -118,11 +121,9 @@ def connect(host, port, user, password): ...@@ -118,11 +121,9 @@ def connect(host, port, user, password):
foo.logfile = logfile foo.logfile = logfile
foo.sendline('') foo.sendline('')
signal.signal(signal.SIGWINCH, sigwinch_passthrough) signal.signal(signal.SIGWINCH, sigwinch_passthrough)
size = getwinsize() foo.interact(escape_character=chr(28))
foo.setwinsize(size[0], size[1])
foo.interact()
except pxssh.ExceptionPxssh as e: except pxssh.ExceptionPxssh as e:
print('密码错误: %s' % e) print('登录失败: %s' % e)
except KeyboardInterrupt: except KeyboardInterrupt:
foo.logout() foo.logout()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment