Posted to tcl by Bradipo at Tue Dec 06 20:11:35 GMT 2016view raw

  1. #!/bin/sh
  2. # \
  3. exec tclsh "$0" ${1+"$@"}
  4.  
  5. proc gotit {fd} {
  6. if {[gets $fd line] <0} {
  7. return
  8. }
  9. puts stderr "PIPEREAD: $line"
  10. }
  11.  
  12. set p [open /tmp/namedpipe r+]
  13. fconfigure $p -blocking 0
  14. fileevent $p readable "gotit $p"
  15. vwait done
  16.