diff options
author | Devaev Maxim <[email protected]> | 2018-10-01 19:30:31 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-10-01 19:30:31 +0300 |
commit | f89918b4bf5c5cd087e9b34a527215ff7baa0bba (patch) | |
tree | af4bf6e61228313fa5ff18af6cbd0011a280530c | |
parent | ed067c80cf15882ce0e879ac72555a264e43a1db (diff) |
streamer: read full stdout
-rw-r--r-- | kvmd/streamer.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kvmd/streamer.py b/kvmd/streamer.py index 24097547..8a23c715 100644 --- a/kvmd/streamer.py +++ b/kvmd/streamer.py @@ -106,17 +106,17 @@ class Streamer: # pylint: disable=too-many-instance-attributes logger.info("Started streamer pid=%d: %s", proc.pid, cmd) empty = 0 - while proc.returncode is None: - line = (await proc.stdout.readline()).decode(errors="ignore").strip() + async for line_bytes in proc.stdout: # type: ignore + line = line_bytes.decode(errors="ignore").strip() if line: - logger.info("streamer: %s", line) + logger.info("Streamer: %s", line) empty = 0 else: empty += 1 if empty == 100: # asyncio bug - break + raise RuntimeError("Streamer/asyncio: too many empty lines") - raise RuntimeError("WTF") + raise RuntimeError("Streamer unexpectedly died") except asyncio.CancelledError: break |