digitalmars.D.learn - using std.process
- Philippe Sigaud <philippe.sigaud gmail.com> Jun 11 2010
- Graham Fawcett <fawcett uwindsor.ca> Jun 11 2010
- BCS <none anon.com> Jun 11 2010
- Philippe Sigaud <philippe.sigaud gmail.com> Jun 12 2010
OK, this is a real newbie question:
How can I use std.process?
when I do:
import std.process;
void main() {
execvp("mkdir", ["test"]);
}
nothing happens.
What am I doing wrong?
I'm on Vista there, didn't try the equivalent under Linux.
Philippe
Jun 11 2010
On Fri, 11 Jun 2010 19:09:04 +0000, Philippe Sigaud wrote:OK, this is a real newbie question: How can I use std.process? when I do: import std.process; void main() { execvp("mkdir", ["test"]); } nothing happens. What am I doing wrong? I'm on Vista there, didn't try the equivalent under Linux.
Try giving an absolute path to 'mkdir'. I'm fairly sure that the exec* family does not use the PATH environment. Best, Graham
Jun 11 2010
Hello Graham,On Fri, 11 Jun 2010 19:09:04 +0000, Philippe Sigaud wrote:OK, this is a real newbie question: How can I use std.process? when I do: import std.process; void main() { execvp("mkdir", ["test"]); } nothing happens. What am I doing wrong? I'm on Vista there, didn't try the equivalent under Linux.
family does not use the PATH environment.
That's what the 'p' in 'vp' stand for: path. OTOH I don't remember if the exec's tack on the exe name to the args so you might need to do: execvp("mkdir",["mkdir","test"]); -- ... <IXOYE><
Jun 11 2010
--0016e6dbe5acc700280488d5723b Content-Type: text/plain; charset=ISO-8859-1 GrahamTry giving an absolute path to 'mkdir'. I'm fairly sure that the exec*family does not use the PATH environment.
supposed to provide the path. But I admit I never tried giving it an entire path. BCS:That's what the 'p' in 'vp' stand for: path. OTOH I don't remember if the exec's tack on the exe name to the args so you might need to do: execvp("mkdir",["mkdir","test"]);
Because arg #0 is the name of the exec itself? *** Ok, I tried your suggestions and obtained some results. Right now, I can even make dmd compile some simple file, like this: execvp("dmd", ["dmd", "test.d"]; It doesn't do anything with just execvp("dmd", ["test.d"]); Now, my goal is to activate the dot executable from graphviz ( http://www.graphviz.org ) and... it works if I use execvp("dot", ["dot", /* arg lis */]); thank to you both! strangely, it takes 22s to produce the pdf, as opposed to about 3s at the command line... I think initially, I stopped it before it could finish its work. Philippe --0016e6dbe5acc700280488d5723b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Graham<br> <div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margi= n: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-le= ft: 1ex;"><div><div class=3D"h5"><blockquote class=3D"gmail_quote" style=3D= "margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padd= ing-left: 1ex;"> Try giving an absolute path to 'mkdir'. I'm fairly sure that th= e exec*<br> family does not use the PATH environment.<br> </blockquote> <br></div></div></blockquote><div><br>I tried the different versions and us= ed execvp precisely because it's supposed to provide the path. But I ad= mit I never tried giving it an entire path.<br><br>=A0<br>BCS:<br></div> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde= r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div class= =3D"h5"></div></div> That's what the 'p' in 'vp' stand for: path.<br> <br> OTOH I don't remember if the exec's tack on the exe name to the arg= s so you might need to do:<br> <br> execvp("mkdir",["mkdir","test"]);<font color= =3D"#888888"><br></font></blockquote><div><br>Because arg #0 is the name of= the exec itself?<br><br>***<br><br><br>Ok, I tried your suggestions and ob= tained some results. Right now, I can even make dmd compile some simple fil= e, like this:<br> <br>execvp("dmd", ["dmd", "test.d"];<br><br>I= t doesn't do anything with just<br><br>execvp("dmd", ["t= est.d"]);<br><br>Now, my goal is to activate the dot executable from g= raphviz<br> ( <a href=3D"http://www.graphviz.org">http://www.graphviz.org</a> )<br><br>= and... it works if I use<br><br>execvp("dot", ["dot",= =A0 /* arg lis */]);<br>=A0thank to you both!<br><br>strangely, it takes 22= s to produce the pdf, as opposed to about 3s at the command line...<br> I think initially, I stopped it before it could finish its work.<br><br><br=Philippe<br></div></div>
--0016e6dbe5acc700280488d5723b--
Jun 12 2010









BCS <none anon.com> 