How to use conditionals with expect.rb?

K

Kazushi Sakuraba

This is a shot in the dark since it appears nobody uses expect.rb.

Does anybody know how to use a conditional with IO.expect("")?

Everytime I enter a string that isn't expected into IO.expect(""), the
script just hangs and I can't do anything with the failure.
 
K

Kazushi Sakuraba

Kazushi said:
This is a shot in the dark since it appears nobody uses expect.rb.

Does anybody know how to use a conditional with IO.expect("")?

Everytime I enter a string that isn't expected into IO.expect(""), the
script just hangs and I can't do anything with the failure.

Well, at least RExpect has the ability to timeout when an unexpected
string is parsed. The verbose and log file absolutely bite though.
 
M

Martin DeMello

This is a shot in the dark since it appears nobody uses expect.rb.

Does anybody know how to use a conditional with IO.expect("")?

Everytime I enter a string that isn't expected into IO.expect(""), the
script just hangs and I can't do anything with the failure.

Can you post your script? I believe the point of expect is to just
keep accepting input till it gets the "expected" value - try entering
the right string after you enter the wrong one. Here's a sample
interaction with expect - I'm assuming ruby expect follows the same
behaviour:

martin@dabba ~ $ cat hi.exp
set timeout -1
expect "hello world\n"
send "we get signal!\n"

martin@dabba ~ $ expect hi.exp
how are you gentlemen?
somebody set up us the bomb
move zig!!!!!!
hello world
we get signal!

martin@dabba ~ $

martin
 
K

Kazushi Sakuraba

Martin said:
Can you post your script? I believe the point of expect is to just
keep accepting input till it gets the "expected" value - try entering
the right string after you enter the wrong one. Here's a sample
interaction with expect - I'm assuming ruby expect follows the same
behaviour:

martin@dabba ~ $ cat hi.exp
set timeout -1
expect "hello world\n"
send "we get signal!\n"

martin@dabba ~ $ expect hi.exp
how are you gentlemen?
somebody set up us the bomb
move zig!!!!!!
hello world
we get signal!

martin@dabba ~ $

martin

There's no way to enter the correct Expect string since it hangs. Also,
don't even think of using RExpect. "RExpect is better than you'd
expect" my ass.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,311
Members
47,986
Latest member
ColbyG935

Latest Threads

Top