Allow env - atf-run to work by setting a default minimal path.

This commit is contained in:
christos 2020-03-31 01:02:18 +00:00
parent acf9dc2f4e
commit 677813249d
1 changed files with 10 additions and 3 deletions

View File

@ -48,9 +48,16 @@ namespace impl = tools::env;
std::string
impl::get(const std::string& name)
{
const char* val = getenv(name.c_str());
assert(val != NULL);
return val;
const char *n =name.c_str();
const char* val = getenv(n);
if (val != NULL)
return val;
if (strcmp(n, "PATH") == 0)
return "/bin:/usr/bin";
throw tools::system_error(IMPL_NAME "::set",
"Cannot get environment variable '" + name +
"'", errno);
}
bool