On Friday, October 5, 2012 8:28:18 AM UTC+2,
arokia.r...@gmail.com wrote:
> I did not get what you meant by "open a pipe to the program/executable" can you be more clear on this.
I wanted to avoid writing a code fragment, but here you are:
proc handleInput {infile} {
if { ![eof $infile] } {
... Still alive ... time to close it?
} else {
set ::forever 1
}
}
set infile [open "|myprogram"]
fileevent $infile readable [list handleInput $infile]
vwait forever
The pipe (the "|" above) establishes a connection between the external program
and your Tcl program. That way you can get the output from the program (and
whether it is at all alive) as it is produced.
Well, this is a sketch, maybe
http://wiki.tcl.tk/1757 will help you
further.
Regards,
Arjen