Start the pager early-enough in nix why-depends

`nix why-depends` is piping its output into a pager by default.
However the pager was only started after the first path is printed,
causing it to be excluded from the pager output.

(Actually the pager was started *inside* the recursive function that was
printing the dependency chain, so a new instance was started at each
level. It’s a little miracle that it worked at all).

Fix #5911
This commit is contained in:
regnat 2022-01-14 13:41:45 +01:00
parent 8a446aff75
commit 81cd0a113b

View file

@ -239,7 +239,6 @@ struct CmdWhyDepends : SourceExprCommand
visitPath(pathS);
RunPager pager;
for (auto & ref : refs) {
std::string hash(ref.second->path.hashPart());
@ -259,6 +258,7 @@ struct CmdWhyDepends : SourceExprCommand
}
};
RunPager pager;
try {
printNode(graph.at(packagePath), "", "");
} catch (BailOut & ) { }