diff options
author | Hemmo Nieminen <hemmo.nieminen@iki.fi> | 2022-02-18 00:00:00 +0200 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-06-09 18:58:33 -0400 |
commit | e8a3f4d38c49ae7a937e0a02db06a73f5593b08f (patch) | |
tree | 31b83c00534f2fa88dff5f0955a836482c52209d | |
parent | 657a6eeb81158e0faaf8ab07e47a4ed62d4ae338 (diff) | |
download | meson-e8a3f4d38c49ae7a937e0a02db06a73f5593b08f.zip meson-e8a3f4d38c49ae7a937e0a02db06a73f5593b08f.tar.gz meson-e8a3f4d38c49ae7a937e0a02db06a73f5593b08f.tar.bz2 |
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.
-rw-r--r-- | mesonbuild/mtest.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 4e8fcc9..ea5b2da 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -1118,10 +1118,11 @@ async def read_decode(reader: asyncio.StreamReader, console_mode: ConsoleUser) - 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) |