diff --git a/lix/legacy/nix-store.cc b/lix/legacy/nix-store.cc index e75e51445..f4b99d559 100644 --- a/lix/legacy/nix-store.cc +++ b/lix/legacy/nix-store.cc @@ -248,7 +248,7 @@ try { auto drv = TRY_AWAIT(store->derivationFromPath(storePath)); StorePathSet outputs; if (forceRealise) - co_return store->queryDerivationOutputs(storePath); + co_return TRY_AWAIT(store->queryDerivationOutputs(storePath)); for (auto & i : drv.outputsAndOptPaths(*store)) { if (!i.second.second) throw UsageError("Cannot use output path of floating content-addressed derivation until we know what it is (e.g. by building it)"); diff --git a/lix/libstore/daemon.cc b/lix/libstore/daemon.cc index c477166f1..8f5ccdfaf 100644 --- a/lix/libstore/daemon.cc +++ b/lix/libstore/daemon.cc @@ -358,7 +358,7 @@ static void performOp(AsyncIoRoot & aio, TunnelLogger * logger, ref store case WorkerProto::Op::QueryDerivationOutputs: { // Only sent if server presents proto version <= 1.21 REMOVE_AFTER_DROPPING_PROTO_MINOR(21); - paths = store->queryDerivationOutputs(path); + paths = aio.blockOn(store->queryDerivationOutputs(path)); break; } default: diff --git a/lix/libstore/remote-store.cc b/lix/libstore/remote-store.cc index 57dfa11fa..5a53e6314 100644 --- a/lix/libstore/remote-store.cc +++ b/lix/libstore/remote-store.cc @@ -319,16 +319,18 @@ StorePathSet RemoteStore::queryValidDerivers(const StorePath & path) } -StorePathSet RemoteStore::queryDerivationOutputs(const StorePath & path) -{ +kj::Promise> RemoteStore::queryDerivationOutputs(const StorePath & path) +try { if (GET_PROTOCOL_MINOR(getProtocol()) >= 22) { - return Store::queryDerivationOutputs(path); + co_return TRY_AWAIT(Store::queryDerivationOutputs(path)); } REMOVE_AFTER_DROPPING_PROTO_MINOR(21); auto conn(getConnection()); conn->to << WorkerProto::Op::QueryDerivationOutputs << printStorePath(path); conn.processStderr(); - return WorkerProto::Serialise::read(*this, *conn); + co_return WorkerProto::Serialise::read(*this, *conn); +} catch (...) { + co_return result::current_exception(); } diff --git a/lix/libstore/remote-store.hh b/lix/libstore/remote-store.hh index cec3c0044..5997790d2 100644 --- a/lix/libstore/remote-store.hh +++ b/lix/libstore/remote-store.hh @@ -62,7 +62,7 @@ public: StorePathSet queryValidDerivers(const StorePath & path) override; - StorePathSet queryDerivationOutputs(const StorePath & path) override; + kj::Promise> queryDerivationOutputs(const StorePath & path) override; std::map> queryPartialDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr) override; std::optional queryPathFromHashPart(const std::string & hashPart) override; diff --git a/lix/libstore/store-api.cc b/lix/libstore/store-api.cc index e51c95e1e..8701001d1 100644 --- a/lix/libstore/store-api.cc +++ b/lix/libstore/store-api.cc @@ -605,14 +605,16 @@ OutputPathMap Store::queryDerivationOutputMap(const StorePath & path, Store * ev return result; } -StorePathSet Store::queryDerivationOutputs(const StorePath & path) -{ +kj::Promise> Store::queryDerivationOutputs(const StorePath & path) +try { auto outputMap = this->queryDerivationOutputMap(path); StorePathSet outputPaths; for (auto & i: outputMap) { outputPaths.emplace(std::move(i.second)); } - return outputPaths; + co_return outputPaths; +} catch (...) { + co_return result::current_exception(); } diff --git a/lix/libstore/store-api.hh b/lix/libstore/store-api.hh index 02db64ca0..af11187ec 100644 --- a/lix/libstore/store-api.hh +++ b/lix/libstore/store-api.hh @@ -444,7 +444,7 @@ public: /** * Query the outputs of the derivation denoted by `path`. */ - virtual StorePathSet queryDerivationOutputs(const StorePath & path); + virtual kj::Promise> queryDerivationOutputs(const StorePath & path); /** * Query the mapping outputName => outputPath for the given