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 #424
Change-Id: Iee793c79ba5a485d6606e0d292ed2eae6dfb7216
This commit is contained in:
parent
9afb0fe41c
commit
3dd7d023f4
|
@ -396,7 +396,7 @@ std::chrono::milliseconds ProgressBar::draw(State & state, const std::optional<s
|
||||||
if (printMultiline && moreActivities)
|
if (printMultiline && moreActivities)
|
||||||
writeToStderr(fmt("And %d more...", moreActivities));
|
writeToStderr(fmt("And %d more...", moreActivities));
|
||||||
|
|
||||||
if (!printMultiline) {
|
if (!printMultiline && !line.empty()) {
|
||||||
line += " " + activity_line;
|
line += " " + activity_line;
|
||||||
writeToStderr("\r" + filterANSIEscapes(line, false, width) + ANSI_NORMAL + "\e[K");
|
writeToStderr("\r" + filterANSIEscapes(line, false, width) + ANSI_NORMAL + "\e[K");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue