[Issue 18425] std.process environment["VAR"] = "NAME" does not always take effect

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18425

Iain Buclaw  changed:

   What|Removed |Added

   Priority|P1  |P3

--


[Issue 18425] std.process environment["VAR"] = "NAME" does not always take effect

2018-02-16 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18425

--- Comment #4 from Rainer Schuetze  ---
> Was this a hand-copied typo, or was there a typo in the original?

Ooops. Typo is in the test only. The result with DFLAGS is the same, though.

> I looked at the code, and it's very complex, so I don't know that it's worth 
> trying to fix.

We could do the same as for posix: call the C runtime instead of
SetEnvironmentVariable. Both dmc and VC have _wputenv

--


[Issue 18425] std.process environment["VAR"] = "NAME" does not always take effect

2018-02-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18425

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||schvei...@yahoo.com

--- Comment #3 from Steven Schveighoffer  ---
(In reply to Rainer Schuetze from comment #1)
>   environment["DLAGS"] = "2";

Was this a hand-copied typo, or was there a typo in the original?

> 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.

Bleh, too bad we can't update snn.lib. This is like papering over the problem.

I looked at the code, and it's very complex, so I don't know that it's worth
trying to fix.

--


[Issue 18425] std.process environment["VAR"] = "NAME" does not always take effect

2018-02-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18425

Rainer Schuetze  changed:

   What|Removed |Added

   Severity|enhancement |normal

--- Comment #2 from Rainer Schuetze  ---
Happens with both dmc and VC libraries.

--


[Issue 18425] std.process environment["VAR"] = "NAME" does not always take effect

2018-02-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18425

Rainer Schuetze  changed:

   What|Removed |Added

 CC||r.sagita...@gmx.de

--- Comment #1 from Rainer Schuetze  ---
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.

--