I have a question about the following code in TCL/EXPECT:
expect {
timeout {
puts "timeout error"
}
-re "Please enter the play name" {
exp_send $common1
exp_continue
}
-re "Please enter the play name_type" {
exp_send $common2
exp_continue
}
-re "Now you can get the information of the play" {
expect {
-re "\r"
}
}
}
if I run the code above, it will be stuck at the second code block(-re "Please enter the play name_type"). why this will happen? and if I move the second code block(-re "Please enter the play name_type") on the top, the first two will pass. what is the reason?
And seems like the third code block is never executed, I added some trace inside of it like this: puts "executed!!!!"
, the message never shows, and seems like it ignored the third code block and executed the code under the whole expect block, how to fix it?