Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

expect -continue_timer

198 views
Skip to first unread message

derek....@csr.com

unread,
Aug 15, 2007, 5:39:34 AM8/15/07
to
hi all

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
}

derek....@csr.com

unread,
Aug 15, 2007, 5:53:26 AM8/15/07
to

forgot to put some version info in here

Using Linux Ubunto 7.04
Expect : 5.43.0
Tcl : 8.4.14

wiede...@googlemail.com

unread,
Aug 15, 2007, 10:09:07 AM8/15/07
to

derek.phi...@csr.com wrote:

> > -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

derek....@csr.com

unread,
Aug 15, 2007, 12:23:24 PM8/15/07
to

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 Klein

unread,
Aug 16, 2007, 4:40:22 AM8/16/07
to
Hmm,
I assumed that your proc oversteps the 5 seconds timout defined
in the beginning?
But some debug statements in the expect branches?

uwe

0 new messages