26 namespace base_internal {
31 const int kMaxEnvVarValueSize = 1024;
34 void SetEnvVar(
const char*
name,
const char*
value) {
36 SetEnvironmentVariableA(name, value);
38 if (value ==
nullptr) {
41 ::setenv(name, value, 1);
49 : var_name_(var_name), was_unset_(false) {
51 char buf[kMaxEnvVarValueSize];
52 auto get_res = GetEnvironmentVariableA(
var_name_.c_str(),
buf,
sizeof(
buf));
56 was_unset_ = (GetLastError() == ERROR_ENVVAR_NOT_FOUND);
61 SetEnvironmentVariableA(
var_name_.c_str(), new_value);
63 const char* val = ::getenv(
var_name_.c_str());
#define ABSL_INTERNAL_CHECK(condition, message)
ScopedSetEnv(const char *var_name, const char *new_value)