summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-10-10 08:10:37 +0300
committerDevaev Maxim <[email protected]>2020-10-10 08:10:37 +0300
commit69509349bde314e89101f1825dfda9292fb5acb7 (patch)
tree320e52564b81ed76396106b9982eec42598a087a /kvmd/apps
parentcf5bc84872d4e865bdf96198b40fda47f7f285a2 (diff)
refactoring
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/kvmd/streamer.py16
1 files changed, 2 insertions, 14 deletions
diff --git a/kvmd/apps/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py
index afddb1db..48336c98 100644
--- a/kvmd/apps/kvmd/streamer.py
+++ b/kvmd/apps/kvmd/streamer.py
@@ -375,23 +375,11 @@ class Streamer: # pylint: disable=too-many-instance-attributes
while True: # pylint: disable=too-many-nested-blocks
try:
await self.__start_streamer_proc()
-
- empty = 0
- async for line_bytes in self.__streamer_proc.stdout: # type: ignore
- line = line_bytes.decode(errors="ignore").strip()
- if line:
- logger.info("Console: %s", line)
- empty = 0
- else:
- empty += 1
- if empty == 100: # asyncio bug
- raise RuntimeError("Streamer/asyncio: too many empty lines")
-
+ assert self.__streamer_proc is not None
+ await aioproc.log_stdout_infinite(self.__streamer_proc, logger)
raise RuntimeError("Streamer unexpectedly died")
-
except asyncio.CancelledError:
break
-
except Exception:
if self.__streamer_proc:
logger.exception("Unexpected streamer error: pid=%d", self.__streamer_proc.pid)