From 7ff60b7445ccb599edcbf0078d181034f61a0859 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 5 Oct 2024 00:38:35 +0200 Subject: libstore: move Goal::exitCode to WorkResult the field is simply duplicated between the two, and now that we can return WorkResults from Worker::run we no longer need both of them. Change-Id: I82fc47d050b39b7bb7d1656445630d271f6c9830 --- src/libstore/build/goal.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/libstore/build/goal.cc') diff --git a/src/libstore/build/goal.cc b/src/libstore/build/goal.cc index ef5e8ae96..c7dee08b7 100644 --- a/src/libstore/build/goal.cc +++ b/src/libstore/build/goal.cc @@ -25,8 +25,6 @@ try { BOOST_OUTCOME_CO_TRY(auto result, co_await workImpl()); trace("done"); - assert(!exitCode.has_value()); - exitCode = result.exitCode; ex = result.ex; notify->fulfill(result); @@ -42,14 +40,17 @@ Goal::waitForGoals(kj::Array>> try { auto left = dependencies.size(); for (auto & [dep, p] : dependencies) { - p = p.then([this, dep, &left](auto _result) { + p = p.then([this, dep, &left](auto _result) -> Result { + BOOST_OUTCOME_TRY(auto result, _result); + left--; trace(fmt("waitee '%s' done; %d left", dep->name, left)); - if (dep->exitCode != Goal::ecSuccess) ++nrFailed; - if (dep->exitCode == Goal::ecNoSubstituters) ++nrNoSubstituters; - if (dep->exitCode == Goal::ecIncompleteClosure) ++nrIncompleteClosure; - return _result; + if (result.exitCode != Goal::ecSuccess) ++nrFailed; + if (result.exitCode == Goal::ecNoSubstituters) ++nrNoSubstituters; + if (result.exitCode == Goal::ecIncompleteClosure) ++nrIncompleteClosure; + + return std::move(result); }).eagerlyEvaluate(nullptr); } @@ -57,11 +58,11 @@ try { while (auto item = co_await collectDeps.next()) { auto & [dep, _result] = *item; - BOOST_OUTCOME_CO_TRYV(_result); + BOOST_OUTCOME_CO_TRY(auto result, _result); waiteeDone(dep); - if (dep->exitCode == ecFailed && !settings.keepGoing) { + if (result.exitCode == ecFailed && !settings.keepGoing) { co_return result::success(); } } -- cgit v1.2.3