This is my first time using expectit - and I am trying to write a code in groovy which connects to a remote ssh Session and execute a few commands. I have 2 sets of questions.
1) After Using jsch to create the session, and defining the ExpectBuilder; the script just hangs after the prompt.
channel.connect()
//Should we be using regular expression to get the prompt, could you provide some examples ? And is this necessary before a command is sent ?
expect.expect(contains("[PROMPT]"))
expect.sendLine("pwd")
2) Would like to confirm the the command send via "expect.sendLine" actually executed. Is there a way we can capture the exit value of the command. For example
def exitValue = "mkdir foo".execute().exitValue()
if(!exitValue)
//do something
Your help in this matter is highly appreciated. Thank you
1) After Using jsch to create the session, and defining the ExpectBuilder; the script just hangs after the prompt.
channel.connect()
//Should we be using regular expression to get the prompt, could you provide some examples ?
And is this necessary before a command is sent ?
expect.expect(contains("[PROMPT]"))
expect.sendLine("pwd”)
2) Would like to confirm the the command send via "expect.sendLine" actually executed. Is there a way we can capture the exit value of the command. For example
def exitValue = "mkdir foo".execute().exitValue()
if(!exitValue)
//do something
--
You received this message because you are subscribed to the Google Groups "Yet another Expect for Java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-expecti...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.