mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-09-01 06:41:30 +00:00
Use waitid() rather than waitpid() to get full exit status
This commit is contained in:
parent
6993157b3a
commit
163c211219
1 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue