You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Environment.SetEnvironmentVariable() works differently to setenv() p/Invoke #30525
Most interestingly, before calling exec but after calling setenv, Environment.GetEnvironmentVariable("ALREADY_CHECKED_LOGIN") returned null.
I'm assuming this behaviour is by design, but I'm not really sure why it is the way it is; I certainly didn't expect setenv to work when Environment.SetEnvironmentVariable() didn't.
> [System.Runtime.InteropServices.RuntimeInformation]::FrameworkDescription
.NET Core 3.0.0-preview6-27804-01
> [System.Runtime.InteropServices.RuntimeInformation]::OSDescription
Darwin 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64
This is a known problem on Unix with no good solution: see e.g. dotnet/coreclr#635.
If you use Environment.SetEnvironmentVariable, use Process.Start to start the process. The environment variables you set on the managed side will be passed to the new process.
If you want to use libc exec, use setenv. Basically, you need to stick to one thing (libc calls or managed APIs).
Activity
rjmholt commentedon Aug 8, 2019
Environment information:
MichalStrehovsky commentedon Aug 8, 2019
This is a known problem on Unix with no good solution: see e.g. dotnet/coreclr#635.
If you use
Environment.SetEnvironmentVariable, useProcess.Startto start the process. The environment variables you set on the managed side will be passed to the new process.If you want to use libc
exec, usesetenv. Basically, you need to stick to one thing (libc calls or managed APIs).rjmholt commentedon Aug 8, 2019
Ah didn't think to search coreclr; this is definitely a duplicate of https://github.com/dotnet/coreclr/issues/635.
In our case, the complicating factor is that there is no new process. Only an
execwith nofork.Thanks for linking that issue!