Posted to tcl by bicepjai at Wed Jun 16 01:59:17 GMT 2010view raw
- fileevent stdin readable [list data stdin]
- fconfigure stdin -blocking 0
- fconfigure stdout -buffering line
- proc data {fd} {
- if {[eof $fd]} {
- exit
- } elseif {[gets $fd line]} {
- puts "$line"
- if {$line eq "quit"} {
- exit
- } elseif {$line eq "pause"} {
- set ::counter 0
- } elseif {$line eq "resume"} {
- set ::counter 0
- }
- }
- }
- proc output { } {
- puts "starting"
- set sendMe [ exec -- dir]
- puts $sendMe
- after 1000 output
- }
- output
- vwait forever