Skip to content

Instantly share code, notes, and snippets.

@max630
Created February 6, 2019 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save max630/049bd8acd9d1d07cbe088e5c40715370 to your computer and use it in GitHub Desktop.
Save max630/049bd8acd9d1d07cbe088e5c40715370 to your computer and use it in GitHub Desktop.
#!/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