path-info: wipe the progress bar before printing

The legitimate output of `nix path-info` may visually interfere with the
progress bar, by appending to stale progress output before the latter has been
erased. Conveniently, all expensive operations (evaluation or building) have
already been performed before, so we can simply wipe the progress bar at this
point to fix the issue.

Fixes: lix-project/lix#343
Change-Id: Id9a807a5c882295b3e6fbf841f9c15dc96f67f6e
This commit is contained in:
alois31 2024-09-18 19:25:25 +02:00
parent 8ab5743904
commit 2afdf1ed66
Signed by untrusted user: alois31
GPG key ID: E0F59EA5E5216914

View file

@ -82,6 +82,10 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
void run(ref<Store> store, StorePaths && storePaths) override void run(ref<Store> store, StorePaths && storePaths) override
{ {
// Wipe the progress bar to prevent interference with the output.
// It's not needed any more because expensive evaluation or builds are already done here.
logger->pause();
size_t pathLen = 0; size_t pathLen = 0;
for (auto & storePath : storePaths) for (auto & storePath : storePaths)
pathLen = std::max(pathLen, store->printStorePath(storePath).size()); pathLen = std::max(pathLen, store->printStorePath(storePath).size());