diff options
author | Peter Mikus <pmikus@cisco.com> | 2019-12-01 07:03:45 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2019-12-01 07:03:45 +0000 |
commit | b036f5584b17d6242a2b621c94ccc91050271218 (patch) | |
tree | 9c45863f67b1af1541b04abf66c1e66811d55857 /resources/libraries | |
parent | 0c6c98846b86a45ac85aea88726ea6b80a27d00a (diff) |
FIX: VAT terminal
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Change-Id: I98fd62e6b5367b23694017d99a1dae7d893326c9
Diffstat (limited to 'resources/libraries')
-rw-r--r-- | resources/libraries/python/ssh.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/resources/libraries/python/ssh.py b/resources/libraries/python/ssh.py index 5359a6e5fb..5c397eeb17 100644 --- a/resources/libraries/python/ssh.py +++ b/resources/libraries/python/ssh.py @@ -302,10 +302,11 @@ class SSH: buf = u"" while not buf.endswith((u":~# ", u":~$ ", u"~]$ ", u"~]# ")): try: - chunk = chan.recv(self.__MAX_RECV_BUF) - if not chunk: + s_out = chan.recv(self.__MAX_RECV_BUF) + if not s_out: break - buf += chunk + buf += s_out.decode(encoding=u'utf-8', errors=u'ignore') \ + if isinstance(s_out, bytes) else s_out if chan.exit_status_ready(): logger.error(u"Channel exit status ready") break @@ -335,10 +336,11 @@ class SSH: buf = u"" while not buf.endswith(prompt): try: - chunk = chan.recv(self.__MAX_RECV_BUF) - if not chunk: + s_out = chan.recv(self.__MAX_RECV_BUF) + if not s_out: break - buf += chunk + buf += s_out.decode(encoding=u'utf-8', errors=u'ignore') \ + if isinstance(s_out, bytes) else s_out if chan.exit_status_ready(): logger.error(u"Channel exit status ready") break |