process output: do not leak ANSI colors past logged stdout/stderr

In jenkins, I still saw incidents of the entire log becoming colored
after a colored stderr snippet was printed to the log. Make absolutely
sure that no unterminated ANSI coloring is leaked.

Change-Id: Ib9ac1eea4a12d6d43ac8614491f016bbe9ca17b1
This commit is contained in:
Neels Hofmeyr 2020-12-06 16:25:51 +01:00
parent 7187510def
commit fb8c02fbd5
1 changed files with 2 additions and 2 deletions

View File

@ -338,7 +338,7 @@ class Process(log.Origin):
with open(path, 'r') as f:
if since_mark > 0:
f.seek(since_mark)
return f.read()
return self.end_ansi_colors(f.read())
def get_output_file(self, which):
''' Return filename for given output '''
@ -354,7 +354,7 @@ class Process(log.Origin):
return None
out = out.splitlines()
tail = min(len(out), tail)
return prefix + ('\n' + prefix).join(out[-tail:])
return prefix + self.end_ansi_colors(('\n' + prefix).join(out[-tail:]))
def get_output_mark(self, which):
'''Usage: