| 79 | } |
| 80 | |
| 81 | void 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 | } |
no test coverage detected