1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-14 04:51:05 +01:00

Get rid of Finally in DerivationBuilderImpl::unprepareBuild

Calling `reset` on this `std::optional` field of `DerivationBuilderImpl`
is also what the (automatically created) destructor of
`DerivationBuilderImpl` will do. We should be making sure that the
derivation builder is cleaned up by the goal anyways, and if we do that,
then this `Finally` is no longer needed.
This commit is contained in:
John Ericson 2025-08-29 13:15:35 -04:00
parent 8825bfa7fe
commit 76125f8eb1
2 changed files with 3 additions and 8 deletions

View file

@ -769,9 +769,11 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
try {
builtOutputs = builder->unprepareBuild();
} catch (BuilderFailureError & e) {
builder.reset();
outputLocks.unlock();
co_return doneFailure(fixupBuilderFailureErrorMessage(std::move(e)));
} catch (BuildError & e) {
builder.reset();
outputLocks.unlock();
// Allow selecting a subset of enum values
# pragma GCC diagnostic push
@ -796,6 +798,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
co_return doneFailure(std::move(e));
}
{
builder.reset();
StorePathSet outputPaths;
for (auto & [_, output] : builtOutputs) {
// for sake of `bmRepair`