From 5d288efa9caf7ae14e8669ebad99d9c3d72fedfd Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Tue, 10 Nov 2015 11:26:31 +0000 Subject: [PATCH] ssh: increase terminal size to avoid issues with echoed command parsing By default the terminal emulated by pxssh is 24x80 in size, which force the addition of unwanted "\r" in long commands. These \r are painful to parse and remove from the echoed command. This patch tries to alleviate this issue by setting a bigger TTY terminal by default. A 200 columns display should be big enough to execute most of the commands. In case longer commands are required it is better have them on a script to push on the target for execution. Signed-off-by: Patrick Bellasi --- devlib/utils/ssh.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devlib/utils/ssh.py b/devlib/utils/ssh.py index 5d2896b..2bde1bb 100644 --- a/devlib/utils/ssh.py +++ b/devlib/utils/ssh.py @@ -57,6 +57,9 @@ def ssh_get_shell(host, username, password=None, keyfile=None, port=None, timeou conn.login(host, username, password, port=port, login_timeout=timeout) except EOF: raise TargetError('Could not connect to {}; is the host name correct?'.format(host)) + conn.setwinsize(500,200) + conn.sendline('') + conn.prompt() return conn