libstore: don't return promises from LocalDerivationGoal::startBuilder

this is misleading at best and dangerous at worst. callers expect all
exceptions thrown here to signal build startup failure, and errors in
the build itself to be signaled through the promise. since this isn't
a virtual method it will always return the same kind of promise, i.e.
we can just call handleChildOutput in the one caller of startBuilder.

Change-Id: I65d06f96ec05a3fcdf2050dbbd87c417c308ecc9
This commit is contained in:
eldritch horrors
2025-01-19 16:40:26 +01:00
parent 2678836e4a
commit 4bb97b2a9b
2 changed files with 4 additions and 8 deletions
+3 -7
View File
@@ -247,10 +247,10 @@ retry:
try {
/* Okay, we have to build. */
auto promise = startBuilder();
startBuilder();
started();
auto r = co_await promise;
auto r = co_await handleChildOutput();
if (r.has_value()) {
// all good so far
} else if (r.has_error()) {
@@ -399,9 +399,7 @@ void LocalDerivationGoal::cleanupPostOutputsRegisteredModeNonCheck()
cleanupPostOutputsRegisteredModeCheck();
}
// NOTE this one isn't noexcept because it's called from places that expect
// exceptions to signal failure to launch. we should change this some time.
kj::Promise<Outcome<void, Goal::WorkResult>> LocalDerivationGoal::startBuilder()
void LocalDerivationGoal::startBuilder()
{
if ((buildUser && buildUser->getUIDCount() != 1)
#if __linux__
@@ -789,8 +787,6 @@ kj::Promise<Outcome<void, Goal::WorkResult>> LocalDerivationGoal::startBuilder()
debug("sandbox setup: " + msg);
msgs.push_back(std::move(msg));
}
return handleChildOutput();
}
+1 -1
View File
@@ -218,7 +218,7 @@ struct LocalDerivationGoal : public DerivationGoal
/**
* Start building a derivation.
*/
kj::Promise<Outcome<void, WorkResult>> startBuilder();
void startBuilder();
/**
* Fill in the environment for the builder.