about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/build.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 1eb7e806ca63..2e3a2221857e 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -911,6 +911,10 @@ DerivationGoal::DerivationGoal(const Path & drvPath, const BasicDerivation & drv
     state = &DerivationGoal::haveDerivation;
     name = (format("building of %1%") % showPaths(outputPaths(drv))).str();
     trace("created");
+
+    /* Prevent the .chroot directory from being
+       garbage-collected. (See isActiveTempFile() in gc.cc.) */
+    worker.store.addTempRoot(drvPath);
 }