mtest: do not process zero byte reads in read_decode() AsyncIO.StreamReader.readuntil() occasionally raises IncompleteRead exception before a byte of data has been read. Do not process the "read" data in those cases.
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 11e4d31..b5182cc 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py
@@ -1123,10 +1123,11 @@ line_bytes = e.partial except asyncio.LimitOverrunError as e: line_bytes = await reader.readexactly(e.consumed) - line = decode(line_bytes) - stdo_lines.append(line) - if console_mode is ConsoleUser.STDOUT: - print(line, end='', flush=True) + if line_bytes: + line = decode(line_bytes) + stdo_lines.append(line) + if console_mode is ConsoleUser.STDOUT: + print(line, end='', flush=True) return ''.join(stdo_lines) except asyncio.CancelledError: return ''.join(stdo_lines)