"Sourcing" a script's env into D?

Nick Sabalausky a at a.a
Thu Sep 29 10:31:13 PDT 2011


Due to process separation, the following won't work:

script.sh:
#!/bin/sh
SOME_VAR=foobar

test.d:
import std.process;
void main()
{
    system("./script.sh");
    assert(environment["SOME_VAR"] == "foobar");
}

This, of course, is because the script is run in a totally separate process 
(AIUI). The same thing happens in Windows, too.

Is there some way to actually get the env that results from the script? I'm 
looking for solutions for both Posix and Windows.




More information about the Digitalmars-d-learn mailing list