Is this expected behaviour or a bug?
Is there a way to force the updating of the buffers keeping the
previous content.
Thanks
Derek
sample code.
.
.
.
.
set timeout 1
set stop1
while { $stop } {
# Now look at each pattern in turn
foreach pattern $patt_list {
expect {
-notransfer -re $pattern {
# we have found one of the list, lets
remove it
# to speed things up a little
set patt_list [ ldelete $patt_list
$pattern ]
if { $patt_list == -1 } {
# Hhm an error deleting from the list
# see below in clear buffer errors
for handling this
set ret_val -2
set stop 0
};# End if patt_list
}
timeout { puts "Here in timeout lookig for
\"$pattern\""}
};#End of expect
};#End foreach
# do some check to get out of the while
.
.
};#End while
Derek
you should use the expect key word full_buffer which is activated
every time
the max_match limit is reached and cache your own results. I would not
use
the -notransfer option because if it does as you say it prevents the
clearing
of the expect_out array and you can manipulate it then you may
inadvertantly
match another of your targets and it will be very difficult to debug.
If at all
possible get all the data into your own buffers then post process it.
I wrote an example for another poster for using the full_buffer
target. It gets
a spawn id from a ssh login and submits the command. The command he
was
useing was ps -aef which went beyond 2000 bytes ( in past it had been
10000).
You can set the size for the match buffer larger but it is better to
just handle it like
below.
proc sendCommand { spawnid retbuffer command prompt { timeout -1 } }
{
set retval 0
upvar $retbuffer buffer
exp_internal 0; # set to one for extensive debug
log_user 0 # set to one to watch action
set bad 0;
exp_send -i $spawnid -- "$command\r"
expect {
-i $spawnid
full_buffer {
send_user " buffer is full... caching"
append buffer $expect_out(buffer);
set bad 0
exp_continue;
}
-re "$prompt" {
# get rid of command at top and prompt at bottom in response
append buffer $expect_out(buffer);
set buffer [string trim [ join [lrange [split $buffer "\n"] 1
end-1 ] "\n" ] ]
set bad 0 ;
}
timeout {
send_user "timeout"
append buffer "\ntimeout"
set bad 1
}
eof {
send_user "Eof detected"
append buffer "\nEOF detected"
set bad 1;
}
}
return $bad;
}
Carl