diff --git a/lix/libstore/realisation.cc b/lix/libstore/realisation.cc index fde768d4a..4e8c37d47 100644 --- a/lix/libstore/realisation.cc +++ b/lix/libstore/realisation.cc @@ -1,6 +1,7 @@ #include "lix/libstore/realisation.hh" #include "lix/libstore/store-api.hh" #include "lix/libutil/closure.hh" +#include "lix/libutil/result.hh" #include namespace nix { @@ -158,11 +159,11 @@ bool Realisation::isCompatibleWith(const Realisation & other) const return false; } -void RealisedPath::closure( +kj::Promise> RealisedPath::closure( Store& store, const RealisedPath::Set& startPaths, RealisedPath::Set& ret) -{ +try { // FIXME: This only builds the store-path closure, not the real realisation // closure StorePathSet initialStorePaths, pathsClosure; @@ -171,18 +172,26 @@ void RealisedPath::closure( store.computeFSClosure(initialStorePaths, pathsClosure); ret.insert(startPaths.begin(), startPaths.end()); ret.insert(pathsClosure.begin(), pathsClosure.end()); + co_return result::success(); +} catch (...) { + co_return result::current_exception(); } -void RealisedPath::closure(Store& store, RealisedPath::Set & ret) const -{ - RealisedPath::closure(store, {*this}, ret); +kj::Promise> RealisedPath::closure(Store& store, RealisedPath::Set & ret) const +try { + TRY_AWAIT(RealisedPath::closure(store, {*this}, ret)); + co_return result::success(); +} catch (...) { + co_return result::current_exception(); } -RealisedPath::Set RealisedPath::closure(Store& store) const -{ +kj::Promise> RealisedPath::closure(Store& store) const +try { RealisedPath::Set ret; - closure(store, ret); - return ret; + TRY_AWAIT(closure(store, ret)); + co_return ret; +} catch (...) { + co_return result::current_exception(); } } // namespace nix diff --git a/lix/libstore/realisation.hh b/lix/libstore/realisation.hh index 463b19916..02697f267 100644 --- a/lix/libstore/realisation.hh +++ b/lix/libstore/realisation.hh @@ -133,9 +133,9 @@ struct RealisedPath { */ StorePath path() const; - void closure(Store& store, Set& ret) const; - static void closure(Store& store, const Set& startPaths, Set& ret); - Set closure(Store& store) const; + kj::Promise> closure(Store & store, Set & ret) const; + static kj::Promise> closure(Store & store, const Set & startPaths, Set & ret); + kj::Promise> closure(Store & store) const; GENERATE_CMP(RealisedPath, me->raw); }; diff --git a/lix/libstore/store-api.cc b/lix/libstore/store-api.cc index 60e927ee6..9262d6c89 100644 --- a/lix/libstore/store-api.cc +++ b/lix/libstore/store-api.cc @@ -1317,7 +1317,7 @@ try { if (&srcStore == &dstStore) co_return result::success(); RealisedPath::Set closure; - RealisedPath::closure(srcStore, paths, closure); + TRY_AWAIT(RealisedPath::closure(srcStore, paths, closure)); TRY_AWAIT(copyPaths(srcStore, dstStore, closure, repair, checkSigs, substitute)); co_return result::success();