Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env tclsh
package require Tk
pack \
[button .send -text Send -command {puts [lindex $pIn 1] $inData}] \
[entry .b -textvariable inData] \
[text .a]
set pIn [chan pipe]
set pOut [chan pipe]
set pr [exec cat <@ [lindex $pIn 0] >@ [lindex $pOut 1] &]
close [lindex $pIn 0]
close [lindex $pOut 1]
fconfigure [lindex $pIn 1] -buffering none
fconfigure [lindex $pOut 0] -blocking 0
fileevent [lindex $pOut 0] readable {
.a insert end [read [lindex $pOut 0] 1000]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.