* Get the environment variable using std::getenv and when it is an empty string (or nullptr), return \c std::nullopt instead. * @param variable The environment variable to read from. * @return The environment value, or \c std::nullopt. */
| 852 | * @return The environment value, or \c std::nullopt. |
| 853 | */ |
| 854 | std::optional<std::string_view> GetEnv(const char *variable) |
| 855 | { |
| 856 | auto val = std::getenv(variable); |
| 857 | if (val == nullptr || *val == '\0') return std::nullopt; |
| 858 | return val; |
| 859 | } |
no outgoing calls
no test coverage detected