www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to keep executed shell running after program exits

reply "tcak" <1ltkrs+3wyh1ow7kzn1k sharklasers.com> writes:
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?
Jul 08 2015
next sibling parent "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> writes:
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.
Jul 09 2015
prev sibling parent "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> writes:
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
Jul 09 2015