summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott <[email protected]>2022-01-21 10:19:34 -0800
committerScott <[email protected]>2022-01-21 10:19:34 -0800
commita4500713dc910eb6ddc3104fd9a58ce3a39d0e7f (patch)
tree1af0393529de93a03dd596710020b4f59573ab46
parent927b6920b62d581556c12ade7e9b09dc8978296b (diff)
Wait for both streams to end.
-rw-r--r--exec_utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/exec_utils.py b/exec_utils.py
index a52e206..b4e88bd 100644
--- a/exec_utils.py
+++ b/exec_utils.py
@@ -30,12 +30,13 @@ def cmd_showing_output(command: str, ) -> int:
sel = selectors.DefaultSelector()
sel.register(p.stdout, selectors.EVENT_READ)
sel.register(p.stderr, selectors.EVENT_READ)
- should_exit = False
- while not should_exit:
+ stream_ends = 0
+ while stream_ends < 2:
for key, _ in sel.select():
char = key.fileobj.read(1)
if not char:
- should_exit = True
+ stream_ends += 1
+ continue
if key.fileobj is p.stdout:
sys.stdout.buffer.write(char)
if char in line_enders: