Hi Alexey, thanks for your fast reply (and for the reply to my question on stackoverflow few days ago).
> If I get you right you want to access the buffer contents if the match was unsuccessful in order, for example, to report an error to the user.
>
Yes this is one of the reasons but not the only.
In general I would like to retrieve the result of a SSH command in any case and not only when it fails.
For example:
expect.sendLine("./giveMeTheResult.sh"); // I execute a command
if (expect.expect(regex(promptReadyRegex)).isSuccessfull()){ // The expect regex blocks the execution till there's not the linux prompt [root@myAddress]# )
//Also if it's successful I would like to obtain the buffer because I would like to read the result string that is located before the String "[root@myAddress]#" .
}
..
What do you think about the possibility to add to your library also another method called isSuccessful(booelan cleanBuffer) that take a boolean parameter that tells to the Expectit if the buffer should be cleared or not? In this manner the default "isSuccessful()" works exactly as now and the new "isSuccessful(boolean)" give to the programmer the choice of maintain the buffer.
Obviously this is just a suggestion it's possible that I'm not taking in consideration other wrong implication that this new behaviour could produce and the difficulty to implement it (I have not seen how the library is implemented).
For now I'll use your workaroud ;) .
Thanks for all your help (and for Expectit library) ;)
Have a nice day.
--
Giuseppe Tino