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
Based on #2837 (review) setEnvironmentVariable should not be used in the tests, since it's an overkill and we don't need to update OS environment to get our internal state updated. setEnvironmentVariable was misused on early stage of gtest transition, it was before we've got special functions for proper internal state updating.
Now env::update(VAR, value) does exactly what we need.
The text was updated successfully, but these errors were encountered:
My first attempt in #2837 was with env::update(), but that broke one definition rule, and I got clang-tidy errors. To make it work, we need to define all environment variables in a single source file and create an interface to import names into units where we need to work with values (DEFINE and DECLARE macros).
Furthermore, the call to the setEnvironemntVariable function does not alter the OS environment variables. Environment variables set with it will only exist for the lifetime of a process. After the program terminates, all variables are removed from the caller's environment. That is because the setenv()/putenv() function on Linux and the SetEnvironmentVariable() function on Windows work only in the local environment.
To update the environment variables on Windows globally (OS level), one must update the Windows registry. On Linux, on the other hand, one needs to run a new shell instance with an updated variables list.
Based on #2837 (review)
setEnvironmentVariable
should not be used in the tests, since it's an overkill and we don't need to update OS environment to get our internal state updated.setEnvironmentVariable
was misused on early stage of gtest transition, it was before we've got special functions for proper internal state updating.Now
env::update(VAR, value)
does exactly what we need.The text was updated successfully, but these errors were encountered: