|
From: Mirko V. <mir...@gm...> - 2024-02-07 00:24:41
|
On Tue, Feb 6, 2024 at 12:52 PM Robert Dodier <rob...@gm...> wrote: > On Sat, Feb 3, 2024 at 7:40 AM Mirko Vukovic <mir...@gm...> > wrote: > > > I can shut down the process by sending the "exit" command. > > > > But I'd also like to send a signal (such as SIGTERM) to shut gnuplot > down. > > Probably a cleaner and system independent way to tell gnuplot to shut > down is just to close the socket through which commands are sent -- I > don't know for sure, but I suspect that gnuplot will terminate if the > socket is closed, since that is a widely used convention for > organizing interprocess communications. > > Maxima (https://maxima.sourceforge.io) is a Common Lisp application > and it has some code to work with gnuplot for plotting; see > src/plot.lisp and src/gnuplot_def.lisp (I think those are the right > file names) to get some ideas about how stuff was handled there. > > Thanks Robert, I looked at the Maxima source in the src/plot.lisp, and your suggestion worked: Doing - with apologies for non-lisp readers that the parenthesis may confuse - (close (ccl:external-process-input-stream process-handle)) closes the process. `process-handle' is the structure returned by the command that launches gnuplot: (ccl:run-program "gnuplot" ...) Mirko |