bitbake: progress: LineFilterProgressHandler - Handle parsing line which ends with CR only

S3 commands need to handle different CR only line endings, update the handler
to cope with this.

(Bitbake rev: 3f7b9c1b429a4c68240e80832a8ef93ee210e5ff)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Przemyslaw Gorszkowski 2021-04-26 09:32:37 +02:00 committed by Richard Purdie
parent 5e8e08df8b
commit a854068b52

View File

@ -94,12 +94,15 @@ class LineFilterProgressHandler(ProgressHandler):
while True:
breakpos = self._linebuffer.find('\n') + 1
if breakpos == 0:
break
# for the case when the line with progress ends with only '\r'
breakpos = self._linebuffer.find('\r') + 1
if breakpos == 0:
break
line = self._linebuffer[:breakpos]
self._linebuffer = self._linebuffer[breakpos:]
# Drop any line feeds and anything that precedes them
lbreakpos = line.rfind('\r') + 1
if lbreakpos:
if lbreakpos and lbreakpos != breakpos:
line = line[lbreakpos:]
if self.writeline(filter_color(line)):
super().write(line)