You can see that dispatch_once is used in __CFGetEnvironment().
This means that once you access ProcessInfo.processInfo.environment the first time it will cache the result and use that for any future accesses. This means that the environment variables updated by the setenv function are not reflected in the value returned by process info. I believe this is the cause of the difference in behaviour between Linux and macOS.
Investigate why dispatch_once was chosen for this function
Look into threading requirements if dispatch_once is removed
The text was updated successfully, but these errors were encountered: