Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devlib/utils/ssh.py: Fix set terminal window size #259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alimon
Copy link

@alimon alimon commented Apr 11, 2018

Ensure that the terminal window size is set to 500x200, if not long
commands (prompt + command > 80 chars) will fail because the pexpect
search to match the command string in order to get the result and the
command is wrapped to first 80 chars.

In order to fix this scenario enables checkwinsize in the shell and use
stty to set the new terminal window size.

Signed-off-by: Aníbal Limón [email protected]

Ensure that the terminal window size is set to 500x200, if not long
commands (prompt + command > 80 chars) will fail because the pexpect
search to match the command string in order to get the result and the
command is wrapped to first 80 chars.

In order to fix this scenario enables checkwinsize in the shell and use
stty to set the new terminal window size.

Signed-off-by: Aníbal Limón <[email protected]>
@alimon
Copy link
Author

alimon commented Apr 11, 2018

Related to,

ARM-software/workload-automation#725

@@ -72,9 +72,15 @@ def ssh_get_shell(host, username, password=None, keyfile=None, port=None, timeou
raise TargetError(message.format(host))
time.sleep(5)

conn.sendline('shopt -s checkwinsize')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we hit similar issue I had a look at this PR, and shopt is a bash-specific builtin, which does not exist in the busybox shell AFAIK (or even zsh, which uses set for similar purposes). I don't think that bash feature has equivalent in all shells, so it should probably not be relied on.

@douglas-raillard-arm
Copy link
Contributor

@marcbonnici That code has been replaced by the paramiko connection for quite a while now, so I think we can close this PR. A similar problem probably exists in the telnet connection but I honestly don't think telnet works at all in the current state.

If we wanted to resurrect it, we would need to be able to multiplex multiple command output in the same terminal (for background command API), which is challenging. And at that rate, it may just be simpler to setup SLIP (IP over serial port) and use SSH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants