2014-10-05 70 views

回答

0

閱讀有關間接產卵ids。這現在起作用。

#!/usr/bin/env expect 

spawn echo 0 Passed 
set list $spawn_id 

spawn echo 1 Passed 
set list "$list $spawn_id" 
set waiting_cnt [llength $list] 

send_user "list is '$list', length $waiting_cnt\n" 

set timeout 2 

expect { 
    -i list eof { 
     set index [lsearch $list $expect_out(spawn_id)] 
     set list [lreplace $list $index $index] 
     if [llength $list] exp_continue 
    } 

    -i list -re Passed { 
     send_user "passed seen on $expect_out(spawn_id)\n" 
     incr waiting_cnt -1 
     exp_continue 
    } 
} 

send_user "both seem to have passed, waiting_cnt = $waiting_cnt\n"