aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-11-22 16:06:44 +0100
committerEelco Dolstra <edolstra@gmail.com>2019-11-22 16:18:13 +0100
commitba87b08f8529e4d9f8c58d8c625152058ceadb75 (patch)
treec78196cbeb52273c3d5b99ff8dee314108940b9a /src/libstore/build.cc
parentfd900c45b5ff9c6dc7f3ec814eca4ad603720899 (diff)
getEnv(): Return std::optional
This allows distinguishing between an empty value and no value.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 35a5388c6..67ccfcee0 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2503,7 +2503,7 @@ void DerivationGoal::initEnv()
already know the cryptographic hash of the output). */
if (fixedOutput) {
for (auto & i : parsedDrv->getStringsAttr("impureEnvVars").value_or(Strings()))
- env[i] = getEnv(i);
+ env[i] = getEnv(i).value_or("");
}
/* Currently structured log messages piggyback on stderr, but we
@@ -3075,7 +3075,7 @@ void DerivationGoal::runChild()
/* The tmpDir in scope points at the temporary build directory for our derivation. Some packages try different mechanisms
to find temporary directories, so we want to open up a broader place for them to dump their files, if needed. */
- Path globalTmpDir = canonPath(getEnv("TMPDIR", "/tmp"), true);
+ Path globalTmpDir = canonPath(getEnv("TMPDIR").value_or("/tmp"), true);
/* They don't like trailing slashes on subpath directives */
if (globalTmpDir.back() == '/') globalTmpDir.pop_back();