Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

using tango.sys.Process

Moderators: kris

Posted: 05/22/08 06:22:24

I'm trying to use D for a little script that builds tango from svn. Using tango.sys.Process to execute the .sh scripts (linux here), I get some errors with the following snippet:

auto p = new Process();
p.workDir="trunk/lib";
p.execute("bash", "build-dmd.sh",  null);
p.wait();
Stdout.stream.copy(p.stdout);
Stdout.stream.copy(p.stderr);

stderr gives me:
make[1]: dmd: Command not found
make[1]: *** [core/BitManip.o] Error 127
make: *** [lib] Error 2

And the last couple of lines from stdout are:
make[1]: Leaving directory `/media/hd4/repos/tango/trunk/lib/compiler/dmd'
make -C ./gc/basic -fposix.mak clean
make[1]: Entering directory `/media/hd4/repos/tango/trunk/lib/gc/basic'
find . -name "*.di" | xargs rm -f
rm -f gc.o gcalloc.o gcbits.o gcstats.o gcx.o
rm -f
rm -f libtango-gc-basic*.a
make[1]: Leaving directory `/media/hd4/repos/tango/trunk/lib/gc/basic'
make -C ./common/tango -fposix.mak lib DC=dmd ADD_DFLAGS="" ADD_CFLAGS="-m32"
make[1]: Entering directory `/media/hd4/repos/tango/trunk/lib/common/tango'
dmd -c -release -O -inline -w -nofloat -version=Posix -Hfcore/BitManip.di core/BitManip.d -ofcore/BitManip.o
make[1]: Leaving directory `/media/hd4/repos/tango/trunk/lib/common/tango'
=
= *** Error ***
=

When using build-dmd.sh directly, or 'bash build-dmd.sh', all is in order.

Author Message

Posted: 05/22/08 06:52:26

You need the environment passed along with your command - get it from tango.sys.Environment.

Posted: 05/22/08 07:18:29

Woohoo it works, awesome, thanks!

Posted: 05/27/08 18:30:54 -- Modified: 05/27/08 18:46:14 by
schveiguy

That seems like a bug.

Reading through the code, on Windows, the behavior when executing with a null environment pointer is to copy the current environment. On Linux, the behavior is to pass NO environment. So I think the answer is to change Process so that an empty environment copies the current environment.

The only problem with all this is, there is no way to specify an empty environment... but is that useful anyways?

In any case, I'll file a ticket.

UPDATE: added ticket #1120