1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 22:33:57 +02:00

getDefaultNixPath: ignore EPERM

(cherry picked from commit a6c78ba367)
This commit is contained in:
Yorick van Pelt 2023-05-11 13:44:16 +02:00 committed by Emily
parent 24e1dc4d74
commit a1c22a7c10

View file

@ -2525,12 +2525,17 @@ Strings EvalSettings::getDefaultNixPath()
{ {
Strings res; Strings res;
auto add = [&](const Path & p, const std::string & s = std::string()) { auto add = [&](const Path & p, const std::string & s = std::string()) {
if (pathExists(p)) { try {
if (s.empty()) { if (pathExists(p)) {
res.push_back(p); if (s.empty()) {
} else { res.push_back(p);
res.push_back(s + "=" + p); } else {
res.push_back(s + "=" + p);
}
} }
} catch (SysError & e) {
// swallow EPERM
if (e.errNo != EPERM) throw;
} }
}; };