Saif
Saif

Reputation: 3452

Not able to erase from input buffer when the line wraps (pexpect)

I am using a script to connect to another server. The skeleton looks something like this:

import pexpect
...
child = pexpect.spawn(f"""ssh {username}@{host}""")
child.setwinsize(136,1000)
child.expect("Password:")
child.sendline(pwd)

However, when I enter a very long input it wraps around to the next line. The problem I am facing is that when I try to erase it (backspace-it), it doesn't take me to the previous line. So the input stays as is on the previous line. But this is how it is shown to me in the terminal, behind the scene the input gets backspaced (if that's a word).

Upvotes: 0

Views: 79

Answers (0)

Related Questions