There is a some small Tk application (let's call it "launcher") which has been made for starting another script (let's call it "rocket" :-) ). I mean I run this launcher, choose/set some parameters and press button "run". Then it creates some config file which is a kind of an input for rocket. Then it should run rocket... And here I've got a problem. I need to see the process of rocket running - if I start it manually from console I see a lot of logs. I tried to run it using `exec`: ====== if [catch {exec rocket} errMsg] { puts "Exception: $errMsg" exit } ====== But it seems rocket starts logging into it's own output or whatever - I can't see anything in the console. And I haven't found any way to redirect it somewhere else except files. Who knows, how to drive the output flow of child process? Or maybe there is another way to resolve the initial task? ---- [AMG]: You will need to capture its stdout and stderr and write to a [text] widget. Here's the simplest way: ====== set command {ls /} ;# Unix example set command {cmd /c dir C:\\} ;# Windows example package require Tk text .t -yscrollcommand {.s set} -state disabled scrollbar .s -orient vertical -command {.t yview} pack .s -side right -fill y pack .t -side left -fill both -expand 1 proc receive {chan} { .t configure -state normal .t insert end [read $chan] .t configure -state disabled .t see end if {[eof $chan]} { close $chan } } set chan [open |[concat $command 2>@1]] fconfigure $chan -blocking 0 fileevent $chan readable [list receive $chan] ====== Things get tricky if you want to handle stdout and stderr separately, for instance give them different colors. See [http://wiki.tcl.tk/23378#pagetocc8c30b1c] for more information. ---- Cool! It works, but it's not quite clear for me how :) (I'm not pro at tcl) I understand Tk area but: 1) What does this do? ====== open |[concat $command 2>@1] ====== 2) What is the difference between "-blocking 0" and "-blocking 1" ? 3) Do I understand correctly that ====== fileevent $chan readable [list receive $chan] ====== means that text widget is updating every time when something appears from $chan ? By the way, one more solution has been suggested (also works): ====== [exec /usr/openwin/bin/xterm -e /bin/bash -c "script;read&"] ====== This way we are able to cose main window with keeping script running in separate. How do you think, with what problems I can come across using it? <> Interprocess Communication | Channel | Widget | GUI