mirror of
https://github.com/NixOS/nix
synced 2025-06-28 17:51:15 +02:00
* Remove lock files after building.
This commit is contained in:
parent
06208d1d86
commit
7a02d95418
3 changed files with 20 additions and 1 deletions
|
@ -43,6 +43,7 @@ static StringSet lockedPaths; /* !!! not thread-safe */
|
|||
|
||||
|
||||
PathLocks::PathLocks(const PathSet & _paths)
|
||||
: deletePaths(false)
|
||||
{
|
||||
/* Note that `fds' is built incrementally so that the destructor
|
||||
will only release those locks that we have already acquired. */
|
||||
|
@ -85,6 +86,17 @@ PathLocks::~PathLocks()
|
|||
for (list<int>::iterator i = fds.begin(); i != fds.end(); i++)
|
||||
close(*i);
|
||||
|
||||
for (Paths::iterator i = paths.begin(); i != paths.end(); i++)
|
||||
for (Paths::iterator i = paths.begin(); i != paths.end(); i++) {
|
||||
if (deletePaths)
|
||||
/* This is not safe in general! */
|
||||
if (unlink(i->c_str()) != 0)
|
||||
throw SysError(format("removing lock file `%1%'") % *i);
|
||||
lockedPaths.erase(*i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PathLocks::setDeletion(bool deletePaths)
|
||||
{
|
||||
this->deletePaths = deletePaths;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue