Thread overview
using std.process
Jun 11, 2010
Philippe Sigaud
Jun 11, 2010
Graham Fawcett
Jun 12, 2010
BCS
Jun 12, 2010
Philippe Sigaud
June 11, 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

June 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
June 12, 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.
> Try giving an absolute path to 'mkdir'. I'm fairly sure that the exec*
> 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><



June 12, 2010
Graham

> Try giving an absolute path to 'mkdir'. I'm fairly sure that the exec*
>> family does not use the PATH environment.
>>
>
>
I tried the different versions and used execvp precisely because it's 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