Posted to tcl by rahl at Wed Nov 16 12:33:28 GMT 2022view raw

  1. set run_till_end 0
  2.  
  3. expect {
  4. "Some match" { do_stuff; exp_continue }
  5.  
  6. "Other match" { do_other_stuff; exp_continue }
  7.  
  8. "Final match" {
  9. # Not exactly stopping, but simplifying
  10. puts "== Stop expecting"
  11. set timeout 1
  12. set run_till_end 1
  13. exp_continue
  14. }
  15.  
  16. timeout {
  17. if {$run_till_end == 1} {
  18. expect {
  19. eof
  20. exp_continue
  21. }
  22. } else {
  23. exit 36
  24. }
  25. }
  26.  
  27. eof
  28. }