(self, pid, pidfd, callback, args)
| 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 | |
| 893 | class _ThreadedChildWatcher: |
| 894 | """Threaded child watcher implementation. |
nothing calls this directly
no test coverage detected