From d88f413e10111748c4721848e803edd61fbc83ba Mon Sep 17 00:00:00 2001 From: Peter Hyatt Date: Fri, 5 Apr 2024 16:17:05 -0400 Subject: [PATCH] Strip extra escape codes on empty lines Signed-off-by: Peter Hyatt --- docker/models/images.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/models/images.py b/docker/models/images.py index fb664e68..7d890a5e 100644 --- a/docker/models/images.py +++ b/docker/models/images.py @@ -317,7 +317,7 @@ class ImageCollection(Collection): if 'stream' in chunk: if stream: for line in chunk["stream"].splitlines(): - if len(line.strip()) > 0: + if len(line.strip()) > 0 and not bool(re.match(r'^(\s*\x1b\[[0-9;]*m)*\s*(\x1b\[0m)?\s*$', line.strip())): if timestamp: print(timestamp_str, "- ", end='') print(line.strip(), flush=True)