From 05aaa180e0684532f8f0621c258c23c662421c1c Mon Sep 17 00:00:00 2001 From: Qubasa Date: Fri, 12 Jan 2024 00:13:21 +0100 Subject: [PATCH] cmd.py: Fix busy loop. --- pkgs/clan-cli/clan_cli/cmd.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/clan-cli/clan_cli/cmd.py b/pkgs/clan-cli/clan_cli/cmd.py index 360ffe5a2..693295b5b 100644 --- a/pkgs/clan-cli/clan_cli/cmd.py +++ b/pkgs/clan-cli/clan_cli/cmd.py @@ -20,12 +20,15 @@ class Log(Enum): BOTH = 3 NONE = 4 + def handle_output(process: subprocess.Popen, log: Log) -> tuple[str, str]: rlist = [process.stdout, process.stderr] stdout_buf = b"" stderr_buf = b"" while process.poll() is None: + if len(rlist) == 0: + break r, _, _ = select.select(rlist, [], [], 0) def handle_fd(fd: IO[Any] | None) -> bytes: