aboutsummaryrefslogtreecommitdiff
path: root/src/libmain
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-31 21:20:59 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-31 21:20:59 +0000
commit207bdcbe86bac5fb9e650d26b22ae33c667151e4 (patch)
tree9ef6560b23571b869214cb3cd2381c1d66f620b7 /src/libmain
parent252c9c91abe146e9c6b16d795c6566df4adafe56 (diff)
* Automatically remove temporary root files.
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 395d9c8b4..23fcf2891 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -13,6 +13,7 @@ extern "C" {
}
#include "globals.hh"
+#include "gc.hh"
#include "shared.hh"
#include "config.h"
@@ -55,6 +56,15 @@ void checkStoreNotSymlink(Path path)
}
+struct RemoveTempRoots
+{
+ ~RemoveTempRoots()
+ {
+ removeTempRoots();
+ }
+};
+
+
void initDerivationsHelpers();
@@ -171,6 +181,10 @@ static void initAndRun(int argc, char * * argv)
else remaining.push_back(arg);
}
+ /* Automatically clean up the temporary roots file when we
+ exit. */
+ RemoveTempRoots removeTempRoots;
+
run(remaining);
}