www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - std.process not working in Windows

reply Jesse Phillips <jessekphillips+D gmail.com> writes:
I've been using the system() function from std.process for some time in Windows
and recently it has stopped working. But it doesn't seem to be a problem with
my source code, dmd, or Windows. 

First I thought it might have been changes I made, so I used an old copy of the
source. Then I thought it might be a regression in dmd so I grabbed 2.035 and
2.030. Then I thought Windows just didn't like system calls any more, so I
found an executable compiled in the past, but it actually worked.

I looked at the return value of system(null) which indicated it found the
shell. And the return value of my call was 0 indicating that it ran
successfully. This makes it very hard to inform the user that nothing actually

Can anyone verify similar behavior, or suggest another avenue that doesn't
involve reinstalling Windows :)
Jan 15 2010
next sibling parent Jesse Phillips <jessekphillips+D gmail.com> writes:
I also tried an call to execv, and just now checked the return status which was
-1. So I guess that could be used to say, "Sorry this program doesn't work,"
but I'd like to be able to actually make these calls. I should try std.c.system
shouldn't I?

import std.process;
import std.stdio;

void main() {
	auto args = ["hello world"];
	writeln(execv("echo", args));
Jan 15 2010
prev sibling parent Jesse Phillips <jessekphillips+D gmail.com> writes:
Scratch that, my company seems to have updated the Anti-virus and that was
bringing my headaches.
Jan 15 2010