Skip to content

Commit 99c1937

Browse files
Евгений БлиновЕвгений Блинов
authored andcommitted
Add PyPy support for Darwin kqueue event-driven waiter
1 parent 47dbdb3 commit 99c1937

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

suby/process_waiting.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ def _wait_pidfd(pid: int, timeout_seconds: Optional[float]) -> None:
2323
_event_driven_waiter = _wait_pidfd
2424

2525
elif sys.platform == 'darwin': # pragma: no cover (!Darwin)
26-
if not hasattr(select, 'kqueue'): # pragma: no cover (Darwin)
26+
if not hasattr(select, 'kqueue') or sys.implementation.name == 'pypy': # pragma: no cover (Darwin and !PyPy)
2727
_event_driven_waiter = None
2828
else:
29-
def _wait_kqueue(pid: int, timeout_seconds: Optional[float]) -> None: # pragma: no cover (!Darwin)
29+
def _wait_kqueue(pid: int, timeout_seconds: Optional[float]) -> None: # pragma: no cover (!Darwin or PyPy)
3030
kq = select.kqueue()
3131
try:
3232
ev = select.kevent(
@@ -39,7 +39,7 @@ def _wait_kqueue(pid: int, timeout_seconds: Optional[float]) -> None: # pragma:
3939
finally:
4040
kq.close()
4141

42-
_event_driven_waiter = _wait_kqueue
42+
_event_driven_waiter = _wait_kqueue # pragma: no cover (!Darwin or PyPy)
4343

4444

4545
def has_event_driven_wait() -> bool:
@@ -50,7 +50,7 @@ def wait_for_process_exit(process: 'Popen[str]', timeout_seconds: Optional[float
5050
if _event_driven_waiter is not None:
5151
try:
5252
_event_driven_waiter(process.pid, timeout_seconds)
53-
return # pragma: no cover (Windows or (Linux and <py39))
53+
return # pragma: no cover (Windows or (Linux and <py39) or (Darwin and PyPy))
5454
except OSError:
5555
pass
5656
if timeout_seconds is None:

0 commit comments

Comments
 (0)