Thread overview
How to keep executed shell running after program exits
Jul 09, 2015
tcak
Jul 09, 2015
Marc Schütz
Jul 09, 2015
Marc Schütz
July 09, 2015
I have written a code to run gnuplot.

[code]
...
auto script = std.stdio.File("/tmp/waveletscript.gnuplot", "w");

script.writeln("set term wxt 1; plot '/tmp/wavelet1.dat';");
script.writeln("set term wxt 2; plot '/tmp/wavelet2.dat';");
script.writeln("set term wxt 3; plot '/tmp/wavelet3.dat';");

script.close();
std.process.executeShell("gnuplot /tmp/waveletscript.gnuplot");
...
[/code]

I can see that gnuplot creates windows and plots, but then it closes immediately. Anyway to execute the shell code in that way that it detaches from running process? I do not want window to be closing.

-----

BTW, as a tutorial to demonstrate use of gnuplot with D, is there any place I can write an article?
July 09, 2015
On Thursday, 9 July 2015 at 02:33:23 UTC, tcak wrote:
> I have written a code to run gnuplot.
>
> [code]
> ...
> auto script = std.stdio.File("/tmp/waveletscript.gnuplot", "w");
>
> script.writeln("set term wxt 1; plot '/tmp/wavelet1.dat';");
> script.writeln("set term wxt 2; plot '/tmp/wavelet2.dat';");
> script.writeln("set term wxt 3; plot '/tmp/wavelet3.dat';");
>
> script.close();
> std.process.executeShell("gnuplot /tmp/waveletscript.gnuplot");
> ...
> [/code]
>
> I can see that gnuplot creates windows and plots, but then it closes immediately. Anyway to execute the shell code in that way that it detaches from running process? I do not want window to be closing.
>
> -----
>
> BTW, as a tutorial to demonstrate use of gnuplot with D, is there any place I can write an article?

I believe the reason is not because the parent exits, but that by default gnuplot exits as soon as it has finished executing its script. It has a `--persist` option that should prevent that.
July 09, 2015
On Thursday, 9 July 2015 at 02:33:23 UTC, tcak wrote:
> BTW, as a tutorial to demonstrate use of gnuplot with D, is there any place I can write an article?

http://wiki.dlang.org/Tutorials