We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c60cf34 commit 73274f0Copy full SHA for 73274f0
test/simple_test.py
@@ -133,7 +133,16 @@ def __init__(self, p: subprocess.Popen):
133
self.p = p
134
135
def wait(self, timeout: Optional[float] = None) -> Any:
136
- return self.p.communicate(timeout=timeout)
+ if sys.platform != "darwin":
137
+ return self.p.communicate(timeout=timeout)
138
+
139
+ # On macOS, communicate() with a timeout can be flaky, so we poll.
140
+ start_time = time.monotonic()
141
+ while self.p.poll() is None:
142
+ if timeout is not None and time.monotonic() - start_time >= timeout:
143
+ raise subprocess.TimeoutExpired(self.p.args, timeout)
144
+ time.sleep(0.032)
145
+ return self.p.communicate()
146
147
@property
148
def returncode(self) -> int:
0 commit comments