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

What about an expect-like interaction support? #60

Open
rzabini opened this issue Apr 12, 2015 · 1 comment
Open

What about an expect-like interaction support? #60

rzabini opened this issue Apr 12, 2015 · 1 comment
Labels

Comments

@rzabini
Copy link

rzabini commented Apr 12, 2015

Hi,
I have some use cases in which an expect-like syntax for interacting with the ssh server would be preferable.
In this approach, you send commands and expect the server to answer with a pattern.
I found this java implementation, and adapted it to the context of groovy-ssh; the result is in this branch of my forked repository. I did not alter any file of the original source, and put the new code in a different package, for the sake of readability.

This is a fragment of a unit test that explains the function:

ssh.run {
    session(ssh.remotes.testServer) {
        shellExpect {
            send 'hello server'
            expectOrThrow 1,'please enter password:'
            send 'Welcome1'
            expectOrThrow 1, 'password OK'
        }
    }
}

If you think this could be useful, I can define a pull request, removing the custom package name.

@int128 int128 added the feature label Apr 16, 2015
@int128
Copy link
Owner

int128 commented Apr 19, 2015

Sounds good. Would you send me a pull request?
Thanks

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

No branches or pull requests

2 participants