更新时间:2023-02-07 14:32:36
你已经在等待循环结束时的 eof
,你只需要使用 wait
和 catch
结果:
You're already waiting for the eof
at the end of your loop, you just need to use wait
and catch
the result:
spawn true
expect eof
catch wait result
exit [lindex $result 3]
以 0 退出.
spawn false
expect eof
catch wait result
exit [lindex $result 3]
以 1 退出.