mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 06:42:28 +00:00
Support --keep-going in nix repair
This commit is contained in:
parent
11593d44aa
commit
93c1d1a976
@ -19,8 +19,32 @@ struct CmdStoreRepair : StorePathsCommand
|
||||
|
||||
void run(ref<Store> store, StorePaths && storePaths) override
|
||||
{
|
||||
size_t errors = 0;
|
||||
|
||||
// Remove duplicates.
|
||||
StorePathSet storePathsSet;
|
||||
for (auto & path : storePaths)
|
||||
store->repairPath(path);
|
||||
storePathsSet.insert(path);
|
||||
|
||||
for (auto & path : storePathsSet) {
|
||||
try {
|
||||
store->repairPath(path);
|
||||
} catch (Error & e) {
|
||||
// RepairFailure already has the path in the error message, so we omit the redundant trace.
|
||||
if (!dynamic_cast<RepairFailure *>(&e))
|
||||
e.addTrace({}, "while repairing path '%s'", store->printStorePath(path));
|
||||
|
||||
if (settings.keepGoing) {
|
||||
errors++;
|
||||
ignoreExceptionExceptInterrupt();
|
||||
}
|
||||
else
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
if (errors)
|
||||
throw Error("could not repair %d store paths", errors);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user