@@ -313,15 +313,26 @@ local function gnuplot_mv (fname, uname)
313
313
end
314
314
end
315
315
316
+ local not_paused = true
317
+ local function kill_plots(self)
318
+ if not_paused then -- Pause only once, independent of the number of streams
319
+ pause("Closing plots, ")
320
+ not_paused = false
321
+ end
322
+ gplot:set_sid(self.sid)
323
+ gplot:printf("set term %s close", self.term)
324
+ end
325
+
316
326
local function teardown_cmd (self, file, fname)
317
- local scrdump, output in self
327
+ local scrdump, output, close_plots in self
318
328
file:close()
319
329
if output ~= false then
320
330
gplot:printf("load('%s')", fname)
321
331
if is_string(scrdump)
322
332
then gnuplot_mv(fname, scrdump)
323
333
else gnuplot_rm(fname)
324
334
end
335
+ if close_plots then atexit(\-> kill_plots(self)) end
325
336
else
326
337
if is_string(scrdump) then
327
338
os.rename(fname, scrdump)
@@ -1005,6 +1016,7 @@ local plot = command "plot" {
1005
1016
1006
1017
-- output
1007
1018
output = nil, -- ("filename") -> pdf | number -> wid
1019
+ close_plots = true, -- boolean, close all plots on exit of MAD-NG or not
1008
1020
scrdump = nil, -- ("filename")
1009
1021
1010
1022
-- title
0 commit comments