Jonathan M Davis wrote:
Peter Sommerfeld wrote:
This works as expected:
string cmd = "dmd src/xyz.d";
int i = system(cmd);
But this not:
string[] cmd;
cmd ~= "src/xyz.d";
int i = execvp("dmd",cmd);
Of course, dmd is in PATH (Win7).
What is wrong here?
Please elaborate on what doesn't work as expected. We can'thelp you if
you don't tell us what's wrong.
Well, system(cmd) compiles xyz.d and creates an executable.
execvp(cmd) does call dmd but that behaves as if no arguments
where given (Usage msg etc). No executables are created.
system should run your command in a new process and return,whereas
execvp will run it and never return, because the
new process replaces your current one.
I did not know that it does not return. Anyway, it should
compile the args IMHO but it does not.
Peter