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

Function SetEnv

util/system/env.cpp:64–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void SetEnv(const TString& key, const TString& value) {
65 bool isOk = false;
66 int errorCode = 0;
67#ifdef _win_
68 isOk = SetEnvironmentVariable(key.data(), value.data());
69 if (!isOk) {
70 errorCode = GetLastError();
71 }
72#else
73 isOk = (0 == setenv(key.data(), value.data(), true /*replace*/));
74 if (!isOk) {
75 errorCode = errno;
76 }
77#endif
78 Y_ENSURE_EX(isOk, TSystemError() << "failed to SetEnv with error-code " << errorCode);
79}
80
81void UnsetEnv(const TString& key) {
82 bool notFound = false;

Callers 6

TESTFunction · 0.85
ReInitializeMethod · 0.85
TScopedEnvironmentMethod · 0.85
~TScopedEnvironmentMethod · 0.85
Y_UNIT_TESTFunction · 0.85

Calls 3

setenvFunction · 0.85
TSystemErrorClass · 0.85
dataMethod · 0.45

Tested by

no test coverage detected