From 207bdcbe86bac5fb9e650d26b22ae33c667151e4 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 31 Jan 2005 21:20:59 +0000 Subject: * Automatically remove temporary root files. --- src/libmain/shared.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/libmain') diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 395d9c8b4cd6..23fcf28916be 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); } -- cgit 1.4.1