Created
February 6, 2019 20:52
-
-
Save max630/049bd8acd9d1d07cbe088e5c40715370 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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