mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
nix-collect-garbage: Handle ENOENT
Don't barf trying to read a link that just got deleted. Fixes #575.
This commit is contained in:
parent
5845ffdf13
commit
7c9d0a5969
1 changed files with 6 additions and 1 deletions
|
@ -28,7 +28,12 @@ void removeOldGenerations(std::string dir)
|
|||
auto type = i.type == DT_UNKNOWN ? getFileType(path) : i.type;
|
||||
|
||||
if (type == DT_LNK && canWrite) {
|
||||
auto link = readLink(path);
|
||||
std::string link;
|
||||
try {
|
||||
link = readLink(path);
|
||||
} catch (SysError & e) {
|
||||
if (e.errNo == ENOENT) continue;
|
||||
}
|
||||
if (link.find("link") != string::npos) {
|
||||
printMsg(lvlInfo, format("removing old generations of profile %1%") % path);
|
||||
if (deleteOlderThan != "")
|
||||
|
|
Loading…
Reference in a new issue