diff options
author | eldritch horrors <pennae@lix.systems> | 2024-06-26 14:08:20 +0200 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-06-26 17:44:04 +0000 |
commit | 3dd7d023f496d97bc9cb1a5fcf889acccfd4a711 (patch) | |
tree | 92711cd1eda8c61cdeb42995d402b47bbab828a3 | |
parent | 9afb0fe41c9c03a168ca6b6d062a68e891b1b203 (diff) |
libmain: don't print empty lines
this most notably affects `nix eval`: if there is no progress bar to be
shown and no activities going on we should not print anything at all. a
progress bar with no activities would print a bunch of terminal escapes
*and a space*, which is not helpful in simple cases like nix eval -E 1.
notably this does *not* affect nix eval called on non-terminal outputs,
but it is slightly confusing nevertheless (and not difficult to avoid).
fixes https://git.lix.systems/lix-project/lix/issues/424
Change-Id: Iee793c79ba5a485d6606e0d292ed2eae6dfb7216
-rw-r--r-- | src/libmain/progress-bar.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libmain/progress-bar.cc b/src/libmain/progress-bar.cc index e36bc0b01..68654c636 100644 --- a/src/libmain/progress-bar.cc +++ b/src/libmain/progress-bar.cc @@ -396,7 +396,7 @@ std::chrono::milliseconds ProgressBar::draw(State & state, const std::optional<s if (printMultiline && moreActivities) writeToStderr(fmt("And %d more...", moreActivities)); - if (!printMultiline) { + if (!printMultiline && !line.empty()) { line += " " + activity_line; writeToStderr("\r" + filterANSIEscapes(line, false, width) + ANSI_NORMAL + "\e[K"); } |