repl: show a progress bar while performing builds

In commit 946fc12e4e, the progress bar in the
repl was disabled again because it was observed to erase incremental output
from attrset evaluations from the terminal. Let's try adding the progress bar
again, this time showing up only when a build is initiated, which does not have
incremental output that could be destroyed to begin with. While this does mean
that we won't have a progress bar for eval-time fetching or IFD, it's still
better than nothing.

Change-Id: If4eb1035cd0c876f5b4ff1e2434b9baf99f150ac
This commit is contained in:
alois31 2024-05-08 18:28:22 +02:00
parent 8822fd7dd5
commit 243c0f18da
Signed by untrusted user: alois31
GPG key ID: E0F59EA5E5216914

View file

@ -605,6 +605,14 @@ ProcessLineResult NixRepl::processLine(std::string line)
Path drvPathRaw = state->store->printStorePath(drvPath); Path drvPathRaw = state->store->printStorePath(drvPath);
if (command == ":b" || command == ":bl") { if (command == ":b" || command == ":bl") {
// TODO: this only shows a progress bar for explicitly initiated builds,
// not eval-time fetching or builds performed for IFD.
// But we can't just show it everywhere, since that would erase partial output from evaluation.
startProgressBar();
Finally stopLogger([&]() {
stopProgressBar();
});
state->store->buildPaths({ state->store->buildPaths({
DerivedPath::Built { DerivedPath::Built {
.drvPath = makeConstantStorePathRef(drvPath), .drvPath = makeConstantStorePathRef(drvPath),