From 03cbc0ecb9402fe7bbe1a2acd4643995003d7bb2 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 5 Oct 2024 00:38:35 +0200 Subject: [PATCH] libstore: move Goal::ex to WorkResult yet another duplicated field. it's the last one though. Change-Id: I352df8d306794d262d8c9066f3be78acd40e82cf --- src/libstore/build/entry-points.cc | 12 ++++++------ src/libstore/build/goal.cc | 1 - src/libstore/build/goal.hh | 6 ------ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/libstore/build/entry-points.cc b/src/libstore/build/entry-points.cc index edfad3cbb..808179a4d 100644 --- a/src/libstore/build/entry-points.cc +++ b/src/libstore/build/entry-points.cc @@ -26,11 +26,11 @@ void Store::buildPaths(const std::vector & reqs, BuildMode buildMod StringSet failed; std::shared_ptr ex; for (auto & [i, result] : goals) { - if (i->ex) { + if (result.ex) { if (ex) - logError(i->ex->info()); + logError(result.ex->info()); else - ex = i->ex; + ex = result.ex; } if (result.exitCode != Goal::ecSuccess) { if (auto i2 = dynamic_cast(i.get())) @@ -119,9 +119,9 @@ void Store::ensurePath(const StorePath & path) auto [goal, result] = *goals.begin(); if (result.exitCode != Goal::ecSuccess) { - if (goal->ex) { - goal->ex->withExitStatus(worker.failingExitStatus()); - throw std::move(*goal->ex); + if (result.ex) { + result.ex->withExitStatus(worker.failingExitStatus()); + throw std::move(*result.ex); } else throw Error(worker.failingExitStatus(), "path '%s' does not exist and cannot be created", printStorePath(path)); } diff --git a/src/libstore/build/goal.cc b/src/libstore/build/goal.cc index c7dee08b7..3f30c922b 100644 --- a/src/libstore/build/goal.cc +++ b/src/libstore/build/goal.cc @@ -25,7 +25,6 @@ try { BOOST_OUTCOME_CO_TRY(auto result, co_await workImpl()); trace("done"); - ex = result.ex; notify->fulfill(result); cleanup(); diff --git a/src/libstore/build/goal.hh b/src/libstore/build/goal.hh index bceea3c54..b524d3118 100644 --- a/src/libstore/build/goal.hh +++ b/src/libstore/build/goal.hh @@ -118,12 +118,6 @@ protected: virtual kj::Promise> workImpl() noexcept = 0; public: - - /** - * Exception containing an error message, if any. - */ - std::shared_ptr ex; - explicit Goal(Worker & worker, bool isDependency) : worker(worker) , isDependency(isDependency)