aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build/derivation-goal.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/build/derivation-goal.cc')
-rw-r--r--src/libstore/build/derivation-goal.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc
index b8c4d278d..037b4fb10 100644
--- a/src/libstore/build/derivation-goal.cc
+++ b/src/libstore/build/derivation-goal.cc
@@ -787,7 +787,7 @@ try {
buildResult.startTime = time(0); // inexact
state = &DerivationGoal::buildDone;
started();
- return {{WaitForWorld{std::move(a.promise)}}};
+ return continueOrError(std::move(a.promise));
},
[&](HookReply::Postpone) -> std::optional<kj::Promise<Result<WorkResult>>> {
/* Not now; wait until at least one child finishes or
@@ -1756,4 +1756,17 @@ void DerivationGoal::waiteeDone(GoalPtr waitee)
}
}
+kj::Promise<Result<Goal::WorkResult>>
+DerivationGoal::continueOrError(kj::Promise<Outcome<void, Goal::Finished>> p)
+{
+ return p.then([](auto r) -> Result<WorkResult> {
+ if (r.has_value()) {
+ return ContinueImmediately{};
+ } else if (r.has_error()) {
+ return r.assume_error();
+ } else {
+ return r.assume_exception();
+ }
+ });
+}
}