https://issues.dlang.org/show_bug.cgi?id=18425

Rainer Schuetze <r.sagita...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagita...@gmx.de

--- Comment #1 from Rainer Schuetze <r.sagita...@gmx.de> ---
Here's a simple test:

import std.process;
import core.stdc.stdlib;
import core.stdc.stdio;

extern(C) int putenv(const char*);

void main()
{
        putenv("DFLAGS=1");
        printf("1.DFLAGS=%s\n", getenv("DFLAGS"));
        environment["DLAGS"] = "2";
        printf("2.DFLAGS=%s\n", getenv("DFLAGS"));
        system("echo 3.DFLAGS=%DFLAGS%");
}

It prints "1" three times.

The issue is that the C runtime caches the environment changes, but
std.process.environment bypasses the cache. Subsequent C runtime calls like
getenv, system or spawn use the cached environment.

--

Reply via email to