-
Notifications
You must be signed in to change notification settings - Fork 3
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
Handling interactive command #1
Comments
Try the cli.dialog "passwd", /Current Password:/i
cli.dialog "Old Password", /New Password:/i
cli.dialog "New Password", /Repeat Password:/i
cli.cmd "New Password" you also could specify the prompt as an option of cli.cmd "passwd", prompt: /Current Password:/i You also could just go the fire and forget way, but you would have way less guarantees: cli.cmd "passwd\nOld Password\nNew Password\nNew Password" But like this, you have a higher risk of it hanging somewhere. If you have a look at the source code, you can see that most methods are just ways around this cli.write "passwd\n"
cli.stdout
# => current buffer state
cli.process
# further 'process' packets of the SSH connection => fills/empties the buffer |
I see, The I don't know if there is a specific STDOUT behavior for the interactive dialogs or not. I understand the gem is made for expected output scripting and in my case I want to make it general case. |
I think the best example for interactive behavior is opening a file using a text editor like nano/vim. |
Hi
I'm writing a simple ssh client, the gem is working well and stable for me. However, I'm facing an issue (the script hangs) when I deal with interactive commands such as
passwd
.Is there an easy way to handle this situation?
The text was updated successfully, but these errors were encountered: