|
From: Daniel J S. <dan...@ie...> - 2004-09-13 14:52:49
|
Hans-Bernhard Broeker wrote:
>Send a SIGINT to the child? Send it a literal Ctrl-C character?
>Send it an 'exit' or 'quit' command?
>
Ethan suggested SIGINT. Those literal characters are treated simply as
any other character by "pause". I needed something to break out of the
current running demo, to start a different demo.
proc loadDemo {x y} {
global dirName
global gpfd
# Send ctrl-C to gnuplot in case a different demo is running.
exec kill -INT [pid $gpfd]
set file [file join $dirName [.sel.f.list get @$x,$y]]
gnuplot "load \"$file\""
}
But thinking about this right now. I bet there may be an issue with
timing. The "kill" command is system level and that doesn't necessarily
complete before Tcl/Tk stuffs "load \"$file\"" into the pipe. So, what
could happen occassionally is the SIGINT happens _after_ some characters
move through the pipe and the command gets partially destroyed,
confusing gnuplot. Hmmm...
Dan
|