From 163c211219ecab5fd888c059f01f329fe216d836 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 13 Jun 2022 00:19:56 +0530 Subject: [PATCH] Use waitid() rather than waitpid() to get full exit status --- kitty/prewarm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kitty/prewarm.py b/kitty/prewarm.py index 991d07602..f7437fcbf 100644 --- a/kitty/prewarm.py +++ b/kitty/prewarm.py @@ -49,12 +49,12 @@ def wait_for_child_death(child_pid: int, timeout: float = 1) -> Optional[int]: st = time.monotonic() while time.monotonic() - st < timeout: try: - pid, status = os.waitpid(child_pid, os.WNOHANG) + x = os.waitid(os.P_PID, child_pid, os.WEXITED | os.WNOHANG) except ChildProcessError: return 0 else: - if pid == child_pid: - return status + if x is not None and x.si_pid == child_pid: + return x.si_status time.sleep(0.01) return None