Posted to tcl by venks at Sun Oct 15 19:29:06 GMT 2017view raw
- 1.
- set fi [open "|$args"]
- puts stderr <<<<[read $fi]>>>>
- close $fi
- 2.
- set fi [open "|$args"]
- chan configure $fi -blocking 0 -buffering line -translation binary
- chan event $fi readable [list [info coroutine] line]
- set linum 0
- while {1} {
- set r [yield]
- if {[set r [gets $fi line]] < 0} {
- l Finished after $linum lines ($r)
- break
- }
- incr linum
- puts $fo $line
- }
- close $fi
- 1 gives me 10 lines. 2 gives me 6 lines consistently. What am I missing?