mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 15:02:42 +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:
parent
8825bfa7fe
commit
76125f8eb1
2 changed files with 3 additions and 8 deletions
|
|
@ -769,9 +769,11 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
||||||
try {
|
try {
|
||||||
builtOutputs = builder->unprepareBuild();
|
builtOutputs = builder->unprepareBuild();
|
||||||
} catch (BuilderFailureError & e) {
|
} catch (BuilderFailureError & e) {
|
||||||
|
builder.reset();
|
||||||
outputLocks.unlock();
|
outputLocks.unlock();
|
||||||
co_return doneFailure(fixupBuilderFailureErrorMessage(std::move(e)));
|
co_return doneFailure(fixupBuilderFailureErrorMessage(std::move(e)));
|
||||||
} catch (BuildError & e) {
|
} catch (BuildError & e) {
|
||||||
|
builder.reset();
|
||||||
outputLocks.unlock();
|
outputLocks.unlock();
|
||||||
// Allow selecting a subset of enum values
|
// Allow selecting a subset of enum values
|
||||||
# pragma GCC diagnostic push
|
# pragma GCC diagnostic push
|
||||||
|
|
@ -796,6 +798,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
||||||
co_return doneFailure(std::move(e));
|
co_return doneFailure(std::move(e));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
builder.reset();
|
||||||
StorePathSet outputPaths;
|
StorePathSet outputPaths;
|
||||||
for (auto & [_, output] : builtOutputs) {
|
for (auto & [_, output] : builtOutputs) {
|
||||||
// for sake of `bmRepair`
|
// for sake of `bmRepair`
|
||||||
|
|
|
||||||
|
|
@ -484,14 +484,6 @@ bool DerivationBuilderImpl::prepareBuild()
|
||||||
|
|
||||||
SingleDrvOutputs DerivationBuilderImpl::unprepareBuild()
|
SingleDrvOutputs DerivationBuilderImpl::unprepareBuild()
|
||||||
{
|
{
|
||||||
// FIXME: get rid of this, rely on RAII.
|
|
||||||
Finally releaseBuildUser([&]() {
|
|
||||||
/* Release the build user at the end of this function. We don't do
|
|
||||||
it right away because we don't want another build grabbing this
|
|
||||||
uid and then messing around with our output. */
|
|
||||||
buildUser.reset();
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Since we got an EOF on the logger pipe, the builder is presumed
|
/* Since we got an EOF on the logger pipe, the builder is presumed
|
||||||
to have terminated. In fact, the builder could also have
|
to have terminated. In fact, the builder could also have
|
||||||
simply have closed its end of the pipe, so just to be sure,
|
simply have closed its end of the pipe, so just to be sure,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue