diff options
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/gc.cc | 10 | ||||
-rw-r--r-- | src/libstore/local-store.cc | 2 | ||||
-rw-r--r-- | src/libstore/local-store.hh | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index e867feeda..fa3b84b7a 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -599,9 +599,13 @@ void LocalStore::collectGarbage(GCAction action, const PathSet & pathsToDelete, printMsg(lvlInfo, format("deleting `%1%'") % *i); /* Okay, it's safe to delete. */ - unsigned long long freed; - deleteFromStore(*i, freed); - bytesFreed += freed; + try { + unsigned long long freed; + deleteFromStore(*i, freed); + bytesFreed += freed; + } catch (PathInUse & e) { + printMsg(lvlError, format("warning: %1%") % e.msg()); + } #ifndef __CYGWIN__ if (fdLock != -1) diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 1bed672d2..b679ffb4f 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -709,7 +709,7 @@ void deleteFromStore(const Path & _path, unsigned long long & bytesFreed) for (PathSet::iterator i = referrers.begin(); i != referrers.end(); ++i) if (*i != path && isValidPathTxn(txn, *i)) - throw Error(format("cannot delete path `%1%' because it is in use by path `%2%'") % path % *i); + throw PathInUse(format("cannot delete path `%1%' because it is in use by path `%2%'") % path % *i); invalidatePath(txn, path); } txn.commit(); diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 8f4ed8fc8..83cb87d45 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -138,6 +138,8 @@ Path queryDeriver(const Transaction & txn, const Path & path); /* Delete a value from the nixStore directory. */ void deleteFromStore(const Path & path, unsigned long long & bytesFreed); +MakeError(PathInUse, Error); + void verifyStore(bool checkContents); /* Whether we are in build users mode. */ |