[WJG] (25/12/23) I'm familiar with the use of Tcl/Tk to act as a GUI front end for console applications: set a command and parameters string, exec/open the application and then gather its output. But, I'm having ongoing issues with both '''talking''' and '''listening''' to a console application. The example I have below is uding ''hoichess'', a simple Linux chess engine available from most repositories. When the script in run in a console, ''hoichess'' executes and any ouput that it writes to stdout is caught and displayed in the text widget. If a valid chess move (lets say e4) is entered from the console ''hoichess'' reads it and a couple of seconds or later its move is displayed in the textbox. However, if a move is typed in the entry widget and returned, the contents are put to the console but these are ignored by ''hoichess''. What am I missing out on? I've tried every which way that I can think of but to no avail. Anyone got any ideas? ====== # !/bin/sh # the next line restarts using tclsh \ exec tclsh "$0" "$@" package require Tk text .t -yscrollcommand {.s set} -state disabled entry .e -textvar e scrollbar .s -orient vertical -command {.t yview} pack .s -side right -fill y pack .t -side left -fill both -expand 1 pack .e proc receive {chan} { .t configure -state normal .t insert end [read $chan] .t configure -state disabled .t see end if {[eof $chan]} { close $chan } } # Run hoichess and capture output set command {hoichess -x off } set chan [open |[concat $command 2>@1]] ;# 0 = stdin 1 = stdout 2 = stderr fconfigure $chan -blocking 0 fileevent $chan readable [list receive $chan] # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # running from terminal is fine, imput read, output loaded by script # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # neither one of these output types appear to be read by hoichess, why? bind .e { puts stderr $e ; flush stderr puts stdout $e ; flush stdout } ======