Posted to tcl by schelte at Sat May 28 20:30:18 GMT 2011view raw

  1. set file testfile.avi
  2. set f [open "| avisplit -i $file -o base -s 5 2>@1"]
  3. fconfigure $f -blocking 0
  4. fileevent $f readable [list WaitForExit $f]
  5.  
  6. proc WaitForExit {fd} {
  7. if {[catch {gets $fd line} fail]} {
  8. return -code error $fail
  9. } elseif {[eof $fd]} {
  10. if {[catch {close $fd} fail]} {
  11. return -code error $fail
  12. } else {
  13. set ::forever Done
  14. return 0
  15. }
  16. } {
  17. return 1
  18. }
  19. }
  20.  
  21. vwait forever