Posted to tcl by Bradipo at Fri Sep 17 23:04:13 GMT 2010view raw

  1. % proc process {fd} {
  2. if {![eof $fd]} {
  3. puts stderr "not eof"
  4. gets $fd data
  5. return
  6. }
  7. set ::done 1
  8. close $fd
  9. puts stderr "all done"
  10. }
  11. % set fd [open "|/bin/sleep 300" w+]
  12. file5
  13. % fileevent $fd readable [list process $fd]
  14. % vwait done
  15. not eof
  16. % close $fd
  17. can not find channel named "file5"
  18.