diff --git a/lix/libstore/parsed-derivations.cc b/lix/libstore/parsed-derivations.cc index 70853f937..992dfb032 100644 --- a/lix/libstore/parsed-derivations.cc +++ b/lix/libstore/parsed-derivations.cc @@ -155,9 +155,9 @@ try { StorePathSet storePaths; for (auto & p : *i) storePaths.insert(store.toStorePath(p.get()).first); - json[i.key()] = store.pathInfoToJSON( + json[i.key()] = TRY_AWAIT(store.pathInfoToJSON( TRY_AWAIT(store.exportReferences(storePaths, inputPaths)), false, true - ); + )); } } diff --git a/lix/libstore/store-api.cc b/lix/libstore/store-api.cc index 76483af61..8cd1db55b 100644 --- a/lix/libstore/store-api.cc +++ b/lix/libstore/store-api.cc @@ -962,11 +962,11 @@ try { co_return result::current_exception(); } -json Store::pathInfoToJSON(const StorePathSet & storePaths, +kj::Promise> Store::pathInfoToJSON(const StorePathSet & storePaths, bool includeImpureInfo, bool showClosureSize, Base hashBase, AllowInvalidFlag allowInvalid) -{ +try { json::array_t jsonList = json::array(); for (auto & storePath : storePaths) { @@ -1032,7 +1032,9 @@ json Store::pathInfoToJSON(const StorePathSet & storePaths, jsonPath["valid"] = false; } } - return jsonList; + co_return jsonList; +} catch (...) { + co_return result::current_exception(); } diff --git a/lix/libstore/store-api.hh b/lix/libstore/store-api.hh index 8cafe0fba..8d449f62e 100644 --- a/lix/libstore/store-api.hh +++ b/lix/libstore/store-api.hh @@ -686,7 +686,7 @@ public: * @param showClosureSize If true, the closure size of each path is * included. */ - nlohmann::json pathInfoToJSON(const StorePathSet & storePaths, + kj::Promise> pathInfoToJSON(const StorePathSet & storePaths, bool includeImpureInfo, bool showClosureSize, Base hashBase = Base::Base32, AllowInvalidFlag allowInvalid = DisallowInvalid); diff --git a/lix/nix/path-info.cc b/lix/nix/path-info.cc index f9902fb35..ba3e5a887 100644 --- a/lix/nix/path-info.cc +++ b/lix/nix/path-info.cc @@ -91,10 +91,10 @@ struct CmdPathInfo : StorePathsCommand, MixJSON pathLen = std::max(pathLen, store->printStorePath(storePath).size()); if (json) { - std::cout << store->pathInfoToJSON( + std::cout << aio().blockOn(store->pathInfoToJSON( // FIXME: preserve order? StorePathSet(storePaths.begin(), storePaths.end()), - true, showClosureSize, Base::SRI, AllowInvalid).dump(); + true, showClosureSize, Base::SRI, AllowInvalid)).dump(); } else {