diff options
author | Hemmo Nieminen <hemmo.nieminen@iki.fi> | 2022-02-18 00:00:00 +0200 |
---|---|---|
committer | Hemmo Nieminen <hemmo.nieminen@iki.fi> | 2022-03-23 00:00:00 +0200 |
commit | 1ede7160ecca9addd9e0d803391404236ff9b340 (patch) | |
tree | a8274c751606aa699e1e24a8d202fe68299f1c62 | |
parent | 5036b9a56cddd1652949889a56c9772bef95b7c1 (diff) | |
download | meson-1ede7160ecca9addd9e0d803391404236ff9b340.zip meson-1ede7160ecca9addd9e0d803391404236ff9b340.tar.gz meson-1ede7160ecca9addd9e0d803391404236ff9b340.tar.bz2 |
mtest: do not process zero byte reads in read_decode()mtesttemp
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 11e4d31..b5182cc 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -1123,10 +1123,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) |