MCPcopy Index your code
hub / github.com/python/cpython / _do_wait

Method _do_wait

Lib/asyncio/unix_events.py:874–891  ·  view source on GitHub ↗
(self, pid, pidfd, callback, args)

Source from the content-addressed store, hash-verified

872 loop._add_reader(pidfd, self._do_wait, pid, pidfd, callback, args)
873
874 def _do_wait(self, pid, pidfd, callback, args):
875 loop = events.get_running_loop()
876 loop._remove_reader(pidfd)
877 try:
878 _, status = os.waitpid(pid, 0)
879 except ChildProcessError:
880 # The child process is already reaped
881 # (may happen if waitpid() is called elsewhere).
882 returncode = 255
883 logger.warning(
884 "child process pid %d exit status already read: "
885 " will report returncode 255",
886 pid)
887 else:
888 returncode = waitstatus_to_exitcode(status)
889
890 os.close(pidfd)
891 callback(pid, returncode, *args)
892
893class _ThreadedChildWatcher:
894 """Threaded child watcher implementation.

Callers

nothing calls this directly

Calls 5

waitstatus_to_exitcodeFunction · 0.85
callbackFunction · 0.70
_remove_readerMethod · 0.45
warningMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected