MCPcopy Create free account
hub / github.com/catboost/catboost / UnsetEnv

Function UnsetEnv

util/system/env.cpp:81–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81void UnsetEnv(const TString& key) {
82 bool notFound = false;
83#ifdef _win_
84 bool ok = SetEnvironmentVariable(key.c_str(), NULL);
85 notFound = !ok && (GetLastError() == ERROR_ENVVAR_NOT_FOUND);
86#else
87 bool ok = (0 == unsetenv(key.c_str()));
88 #if defined(_darwin_)
89 notFound = !ok && (errno == EINVAL);
90 #endif
91#endif
92 Y_ENSURE_EX(ok || notFound, TSystemError() << "failed to unset environment variable " << key.Quote());
93}

Callers 3

TESTFunction · 0.85
ReInitializeMethod · 0.85
Y_UNIT_TESTFunction · 0.85

Calls 3

TSystemErrorClass · 0.85
unsetenvFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected