From 8c1e9751af769680a7c5eca8ded9275c312835c5 Mon Sep 17 00:00:00 2001 From: Brendan Haines Date: Sun, 8 Dec 2024 13:24:46 -0700 Subject: [PATCH] Fix truncation warning --- goat_monitor/goat_monitor.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/goat_monitor/goat_monitor.py b/goat_monitor/goat_monitor.py index cc76504..f7d0ebc 100644 --- a/goat_monitor/goat_monitor.py +++ b/goat_monitor/goat_monitor.py @@ -98,13 +98,12 @@ def wrap(command: List[str], config: Path, retries: int, version: bool, dry_run: MAX_LINES = 20 lines = stdout.splitlines() + truncated = False if len(lines) > MAX_LINES: + truncated = True lines = lines[-MAX_LINES:] message = ( - "Command:\n" - + " ".join(command) - + f'\n\nResult{ " (truncated)" if len(lines) > MAX_LINES else ""}:\n' - + "\n".join(lines) + "Command:\n" + " ".join(command) + f'\n\nResult{ " (truncated)" if truncated else ""}:\n' + "\n".join(lines) ) if not dry_run: