From 0d9645b2506d7795c689c2f2586818a3b96281d0 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 26 May 2016 20:52:52 +0100 Subject: Always remove tmp dir after scan regardless of successfulness --- gentoobrowse-api/service/maintenanceimpl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gentoobrowse-api/service/maintenanceimpl.cpp b/gentoobrowse-api/service/maintenanceimpl.cpp index 4ac065c..d5c6b64 100644 --- a/gentoobrowse-api/service/maintenanceimpl.cpp +++ b/gentoobrowse-api/service/maintenanceimpl.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -172,7 +173,6 @@ namespace Gentoo { for (const auto & fp : fps) { fp.second->apply(dbc); } - boost::filesystem::remove_all(tmp); dbc->execute("DROP TABLE filelist"); for (const auto & fp : fps) { fp.second->tidy(dbc); @@ -183,6 +183,10 @@ namespace Gentoo { Maintenance::refreshPackageTree(const Ice::Current &) { auto tmp = boost::filesystem::temp_directory_path() / "import"; + AdHoc::ScopeExit([&tmp]{ + boost::system::error_code ec; + boost::filesystem::remove_all(tmp, ec); + }); auto dbc = db->get(); dbc->execute("SET search_path = gentoobrowse, pg_catalog"); DB::TransactionScope tx(dbc.get()); -- cgit v1.2.3