Dear all,
Recently we spent a few days in figuring out the best way for doing a unix pipe through AppleScript. We have found a way that works quite well (by creating a temporary file which acts like a pipe), but we still have a few problems killing the processes we have spawned.
First we tail a temporary file into a gnuplot. We are using the bash-terminal for ensuring compatability with the Terminal. This creates three processes: bash, tail and gnuplot.
do shell script "bash -c \"tail -f /tmp/output1 | gnuplot\" &> /dev/null & echo $!"
The resulting PID we get as a result of this line is the one of the bash-shell. However when we kill this process at a later stage, through the statement below, only the bash-process gets killed and the two other processes keep on running.
do shell script "kill pid_returned_by_previous_line"
For your information, we are writing some research tools in Lisp (Macintosh Common Lisp) and we need some way to create unix pipes for plotting graphs in gnuplot.
Also note that we’d like to show several graphs at the same time which limits our options (for instance we can’t kill processes using their names).
Thanks for any insights we get by your feedback,
Joris