Strip extra escape codes on empty lines

Signed-off-by: Peter Hyatt <peter.hyatt@gmail.com>
This commit is contained in:
Peter Hyatt 2024-04-05 16:17:05 -04:00
parent fc5438cbee
commit d88f413e10
No known key found for this signature in database
GPG Key ID: 2F633F07DB67BF81
1 changed files with 1 additions and 1 deletions

View File

@ -317,7 +317,7 @@ class ImageCollection(Collection):
if 'stream' in chunk: if 'stream' in chunk:
if stream: if stream:
for line in chunk["stream"].splitlines(): 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: if timestamp:
print(timestamp_str, "- ", end='') print(timestamp_str, "- ", end='')
print(line.strip(), flush=True) print(line.strip(), flush=True)