Go to the source code of this file.
Functions | |
std::optional< std::string > | nix::getEnv (const std::string &key) |
std::optional< OsString > | nix::getEnvOs (const OsString &key) |
std::optional< std::string > | nix::getEnvNonEmpty (const std::string &key) |
std::map< std::string, std::string > | nix::getEnv () |
int | nix::setEnv (const char *name, const char *value) |
int | nix::setEnvOs (const OsString &name, const OsString &value) |
void | nix::clearEnv () |
void | nix::replaceEnv (const std::map< std::string, std::string > &newEnv) |
Utilities for working with the current process's environment variables.
void nix::clearEnv | ( | ) |
Clear the environment.
std::map< std::string, std::string > nix::getEnv | ( | ) |
Get the entire environment.
std::optional< std::string > nix::getEnv | ( | const std::string & | key | ) |
std::optional< std::string > nix::getEnvNonEmpty | ( | const std::string & | key | ) |
std::optional< OsString > nix::getEnvOs | ( | const OsString & | key | ) |
Like getEnv
, but using OsString
to avoid coercions.
void nix::replaceEnv | ( | const std::map< std::string, std::string > & | newEnv | ) |
Replace the entire environment with the given one.
Like POSIX setenv
, but always overrides.
We don't need the non-overriding version, and this is easier to reimplement on Windows.