I've just been debugging an expect script, it makes use of
exp_continue to look for responses from a command sent to a remote
device. I'm collecting information as I go and will stop when I see a
specific pattern. all seems well and it has worked reasonably reliably
for a while. Recently a pattern was introduced to start removing whole
lines from the buffer, there is some other cruft from previous
commands that we want to throw away if we don't match our patterns,
this was an attempt to over come another issue which has been fixed.
This pattern uses exp_continue but also adds the -continue_timer
option.
Now with just exp_continue we see the buffer being updated, using
exp_internal, when the -continue_timer option is used, we timeout as
the buffer is not updated with the data that we are "expecting".
This behaviour isn't described in THE book and I was wondering if
anybody else has seen it or has an explanation. I include a sample
procedure below.
proc do_d_all { id } {
set con_list ""
set ret_val 0
set timeout 5
set spawn_id $id
exp_send "sym\r"
# Gather a list of the connections
expect {
-re {(acl[0-9]+):0x[0-9a-fA-F]+} {
lappend con_list $expect_out(1,string)
exp_continue
}
-re {pb:[0-9a-fA-Fx]+[\n\r]} { }
-re "\[^\n\r]*\[\n\r]+" {exp_continue -continue_timer }
timeout { puts "Timeout waiting for response to sym" ; return
-1}
}
return 0
}
forgot to put some version info in here
Using Linux Ubunto 7.04
Expect : 5.43.0
Tcl : 8.4.14
> > -re "\[^\n\r]*\[\n\r]+" {exp_continue -continue_timer }
the bare
exp_continue
restarts the timeout timer. i.e. you get the full complement
of seconds defined in $timeout until timeout
exp_continue -continue_timer
continues with timeout counting just as if nothing happened.
uwe
Yes, thats what I understood from the books explanation.
I don't understand why the buffers are not updated during the timer
period
Derek
uwe