aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorick van Pelt <yorick@yorickvanpelt.nl>2023-05-11 13:44:16 +0200
committerYorick van Pelt <yorick@yorickvanpelt.nl>2023-05-26 15:36:46 +0200
commita6c78ba367725a81aa631a7df2d0840ddd25faf5 (patch)
tree4384903bc23af08836ac3330e47202051ae2d2f2 /src
parentb7cde90c6b479562eb9f1d9df399d04cf9c42aad (diff)
getDefaultNixPath: ignore EPERM
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/eval.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 585670e69..61012f2ab 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -2620,12 +2620,17 @@ Strings EvalSettings::getDefaultNixPath()
{
Strings res;
auto add = [&](const Path & p, const std::string & s = std::string()) {
- if (pathExists(p)) {
- if (s.empty()) {
- res.push_back(p);
- } else {
- res.push_back(s + "=" + p);
+ try {
+ if (pathExists(p)) {
+ if (s.empty()) {
+ res.push_back(p);
+ } else {
+ res.push_back(s + "=" + p);
+ }
}
+ } catch (SysError & e) {
+ // swallow EPERM
+ if (e.errNo != EPERM) throw;
}
};