Function Subspace :: sus :: env :: var

auto var(const std::string& key) -> Result<std::string, VarError>

Fetches the environment variable key from the current process.

Errors

This function will return an error if the environment variable isn't set.

This function may return an error if the key is not a valid multi-byte encoding for the current locale (typically utf8).

This function may return an error if the environment variable's name contains the equal sign character '=' or the NUL character '\0'.

TODO: Figure out a nicer way to receive unowned possibly-null-terminated strings. string_view reports a size before the null so you can't tell and you need to copy from it.