Using Expect in Ruby



I'm using Expect inside of a ruby script to control an external
program. So far I have only used libexpect from a C program and would
have several questions regarding the Ruby interface of Expect, maybe
someone already experienced using it:

After having processed the output of the external program that I'm
interested in I would like to empty the expect buffer by expecting an
EOF marker. In an expect script this can be done by "expect eof
{ doSomething }". Does anyone know how this can be done in Ruby?

How can I know whether the external program has already finished?

How to handle several different cases inside of an expect statement:
expect {
timeout { doAction1 }
eof { doAction2 }
...
}

Is there any documentation for the ruby interface?

I would also be very grateful for partial answers and/or any related
information.

Thanks in advance,

Stephan
.



Relevant Pages