You can do this with Tcl ! I wrote an extension called "pipethread" to make UNIX shell pipelining more natural. It uses threads instead of processes but otherwise operates pretty similarly.
Example: set lsOutput [pipethread::pipe exec ls | exec tac | foreach line { puts $outchan "[string length $line]:$line" } | { gets $inchan line; puts $outchan $line }]
Example: set lsOutput [pipethread::pipe exec ls | exec tac | foreach line { puts $outchan "[string length $line]:$line" } | { gets $inchan line; puts $outchan $line }]
Usage: https://chiselapp.com/user/rkeene/repository/pipethread/arti...