On Tuesday, 12 March 2013 at 21:39:47 UTC, Steven Schveighoffer wrote:
I'd be very interested to hear if you have a suggestion for a better way to do it, keeping in mind that there needs to be *some* way to clear the environment too.

Sadly, no I don't. I had hoped [] would allocate an empty AA, but it fails to compile.

Note that you can "hack" it by setting a single environment variable which nobody will ever use.

i.e. spawnProcess("blah.exe", ["_____":"_____"]);

But that is really, really ugly.

How about this:

@property string[string] emptyEnvironment()
{
    string[string] result;
    result["a"] = "a";
    result.remove("a");
    assert(result && result.length == 0);
    return result;
}

(can be cached to avoid allocating each time)

Reply via email to