summaryrefslogtreecommitdiff
path: root/buildstream/_frontend
diff options
context:
space:
mode:
authorTristan Maat <tm@tlater.net>2019-01-02 18:19:27 +0100
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2019-01-18 22:47:46 +0000
commitfff882fef95f1f66fd8619d386b208f6ab64470a (patch)
tree6d95ef8ba13593360a49284b8bb7b465824b3d03 /buildstream/_frontend
parentaa3411f94574d4e2937e3b7b559cf336635ab10c (diff)
downloadbuildstream-fff882fef95f1f66fd8619d386b208f6ab64470a.tar.gz
widget.py: Avoid "showing 0 lines" messages when there are no lines
This happened when bst is invoked with --message-lines 0 or --error-lines 0, and was arguably a little too verbose (the user explicitly asked us not to show them any lines, after all). Fixes #779
Diffstat (limited to 'buildstream/_frontend')
-rw-r--r--buildstream/_frontend/widget.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index a9e5eeafb..30c2e9e1a 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -647,8 +647,9 @@ class LogLine(Widget):
abbrev = False
if message.message_type not in ERROR_MESSAGES \
and not frontend_message and n_lines > self._message_lines:
- abbrev = True
lines = lines[0:self._message_lines]
+ if self._message_lines > 0:
+ abbrev = True
else:
lines[n_lines - 1] = lines[n_lines - 1].rstrip('\n')
@@ -674,7 +675,7 @@ class LogLine(Widget):
if self.context is not None and not self.context.log_verbose:
text += self._indent + self._err_profile.fmt("Log file: ")
text += self._indent + self._logfile_widget.render(message) + '\n'
- else:
+ elif self._log_lines > 0:
text += self._indent + self._err_profile.fmt("Printing the last {} lines from log file:"
.format(self._log_lines)) + '\n'
text += self._indent + self._logfile_widget.render(message, abbrev=False) + '\n'