I have the following code for listening at a serial port:
set timeout -1
log_user 0
set port [lindex $argv 0]
spawn /usr/bin/cu -l $port
proc receive { str } {
set timeout 5
expect
{
timeout { send_user "\nDone\n"; }
}
set timeout -1
}
expect {
"XXXXXX\r" { receive $expect_out(0,string); exp_continue; }
}
Why does this give a
invalid command name "
error after the 5 second timeout elapses in the procedure? Are the nested expects OK?