(self, loop, expected_pid, callback, args)
| 925 | thread.start() |
| 926 | |
| 927 | def _do_waitpid(self, loop, expected_pid, callback, args): |
| 928 | assert expected_pid > 0 |
| 929 | |
| 930 | try: |
| 931 | pid, status = os.waitpid(expected_pid, 0) |
| 932 | except ChildProcessError: |
| 933 | # The child process is already reaped |
| 934 | # (may happen if waitpid() is called elsewhere). |
| 935 | pid = expected_pid |
| 936 | returncode = 255 |
| 937 | logger.warning( |
| 938 | "Unknown child process pid %d, will report returncode 255", |
| 939 | pid) |
| 940 | else: |
| 941 | returncode = waitstatus_to_exitcode(status) |
| 942 | if loop.get_debug(): |
| 943 | logger.debug('process %s exited with returncode %s', |
| 944 | expected_pid, returncode) |
| 945 | |
| 946 | if loop.is_closed(): |
| 947 | logger.warning("Loop %r that handles pid %r is closed", loop, pid) |
| 948 | else: |
| 949 | loop.call_soon_threadsafe(callback, pid, returncode, *args) |
| 950 | |
| 951 | self._threads.pop(expected_pid) |
| 952 | |
| 953 | def can_use_pidfd(): |
| 954 | if not hasattr(os, 'pidfd_open'): |
nothing calls this directly
no test coverage detected