diff --git a/lix/legacy/dotgraph.cc b/lix/legacy/dotgraph.cc index 8a22c2892..eec1f0a3a 100644 --- a/lix/legacy/dotgraph.cc +++ b/lix/legacy/dotgraph.cc @@ -1,5 +1,6 @@ #include "dotgraph.hh" #include "lix/libstore/store-api.hh" +#include "lix/libutil/result.hh" #include @@ -41,8 +42,8 @@ static std::string makeNode(std::string_view id, std::string_view label, } -void printDotGraph(ref store, StorePathSet && roots) -{ +kj::Promise> printDotGraph(ref store, StorePathSet && roots) +try { StorePathSet workList(std::move(roots)); StorePathSet doneSet; @@ -64,6 +65,9 @@ void printDotGraph(ref store, StorePathSet && roots) } cout << "}\n"; + co_return result::success(); +} catch (...) { + co_return result::current_exception(); } diff --git a/lix/legacy/dotgraph.hh b/lix/legacy/dotgraph.hh index ec0fcc9d0..2175ca2d6 100644 --- a/lix/legacy/dotgraph.hh +++ b/lix/legacy/dotgraph.hh @@ -5,6 +5,6 @@ namespace nix { -void printDotGraph(ref store, StorePathSet && roots); +kj::Promise> printDotGraph(ref store, StorePathSet && roots); } diff --git a/lix/legacy/graphml.cc b/lix/legacy/graphml.cc index c67d6a204..5cb4f6bc0 100644 --- a/lix/legacy/graphml.cc +++ b/lix/legacy/graphml.cc @@ -1,6 +1,7 @@ #include "graphml.hh" #include "lix/libstore/store-api.hh" #include "lix/libstore/derivations.hh" +#include "lix/libutil/result.hh" #include @@ -46,8 +47,8 @@ static std::string makeNode(const ValidPathInfo & info) } -void printGraphML(ref store, StorePathSet && roots) -{ +kj::Promise> printGraphML(ref store, StorePathSet && roots) +try { StorePathSet workList(std::move(roots)); StorePathSet doneSet; std::pair ret; @@ -81,6 +82,9 @@ void printGraphML(ref store, StorePathSet && roots) cout << "\n"; cout << "\n"; + co_return result::success(); +} catch (...) { + co_return result::current_exception(); } diff --git a/lix/legacy/graphml.hh b/lix/legacy/graphml.hh index e8c84bea3..48e04fe41 100644 --- a/lix/legacy/graphml.hh +++ b/lix/legacy/graphml.hh @@ -5,6 +5,6 @@ namespace nix { -void printGraphML(ref store, StorePathSet && roots); +kj::Promise> printGraphML(ref store, StorePathSet && roots); } diff --git a/lix/legacy/nix-store.cc b/lix/legacy/nix-store.cc index 6dbeecef7..f1ce0298e 100644 --- a/lix/legacy/nix-store.cc +++ b/lix/legacy/nix-store.cc @@ -429,7 +429,7 @@ static void opQuery(AsyncIoRoot & aio, Strings opFlags, Strings opArgs) for (auto & i : opArgs) for (auto & j : aio.blockOn(maybeUseOutputs(store->followLinksToStorePath(i), useOutput, forceRealise))) roots.insert(j); - printDotGraph(ref(store), std::move(roots)); + aio.blockOn(printDotGraph(ref(store), std::move(roots))); break; } @@ -438,7 +438,7 @@ static void opQuery(AsyncIoRoot & aio, Strings opFlags, Strings opArgs) for (auto & i : opArgs) for (auto & j : aio.blockOn(maybeUseOutputs(store->followLinksToStorePath(i), useOutput, forceRealise))) roots.insert(j); - printGraphML(ref(store), std::move(roots)); + aio.blockOn(printGraphML(ref(store), std::move(roots))); break; }