diff options
author | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-05-26 11:14:08 -0400 |
---|---|---|
committer | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-05-26 11:14:08 -0400 |
commit | 6d73c100417c68a27a23194c78f1252ca511e250 (patch) | |
tree | 04eea8818b97d46fe28ade241069a3650f25a0c6 /src/nix/progress-bar.cc | |
parent | 8aa46cd340c1294c3d06cd52f85c906bdf749070 (diff) | |
parent | 3d3c219d917525b0a131c4332dd65eadfc818f49 (diff) |
Merge remote-tracking branch 'origin/master' into enum-FileIngestionMethod
Diffstat (limited to 'src/nix/progress-bar.cc')
-rw-r--r-- | src/nix/progress-bar.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/nix/progress-bar.cc b/src/nix/progress-bar.cc index 26631416c..8e7ba95a3 100644 --- a/src/nix/progress-bar.cc +++ b/src/nix/progress-bar.cc @@ -7,6 +7,7 @@ #include <atomic> #include <map> #include <thread> +#include <iostream> namespace nix { @@ -190,8 +191,8 @@ public: i->s = fmt("querying " ANSI_BOLD "%s" ANSI_NORMAL " on %s", name, getS(fields, 1)); } - if ((type == actDownload && hasAncestor(*state, actCopyPath, parent)) - || (type == actDownload && hasAncestor(*state, actQueryPathInfo, parent)) + if ((type == actFileTransfer && hasAncestor(*state, actCopyPath, parent)) + || (type == actFileTransfer && hasAncestor(*state, actQueryPathInfo, parent)) || (type == actCopyPath && hasAncestor(*state, actSubstitute, parent))) i->visible = false; @@ -416,7 +417,7 @@ public: if (!s2.empty()) { res += " ("; res += s2; res += ')'; } } - showActivity(actDownload, "%s MiB DL", "%.1f", MiB); + showActivity(actFileTransfer, "%s MiB DL", "%.1f", MiB); { auto s = renderActivity(actOptimiseStore, "%s paths optimised"); @@ -442,6 +443,18 @@ public: return res; } + + void writeToStdout(std::string_view s) override + { + auto state(state_.lock()); + if (state->active) { + std::cerr << "\r\e[K"; + Logger::writeToStdout(s); + draw(*state); + } else { + Logger::writeToStdout(s); + } + } }; void startProgressBar(bool printBuildLogs) |