diff options
author | Tristan Maat <tm@tlater.net> | 2019-01-02 18:19:27 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2019-01-18 22:47:46 +0000 |
commit | fff882fef95f1f66fd8619d386b208f6ab64470a (patch) | |
tree | 6d95ef8ba13593360a49284b8bb7b465824b3d03 /buildstream/_frontend | |
parent | aa3411f94574d4e2937e3b7b559cf336635ab10c (diff) | |
download | buildstream-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.py | 5 |
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' |