On Linux, a pidfd file descriptor can be created with os.pidfd_open() (added to Python 3.9). It would avoid even more race conditions. The best would be to request a pidfd file descriptor directly when we spawn the process which is possible on recent Linux kernel versions.
> we should probably document it clearly in Popen.send_signal() and all of its callers that these functions might reap the child.
Feel free to propose a PR to document the behavior.
I'm not sure of what you mean by send_signal() which "reaps" the child process.
See also bpo-40550.
Anyway, this issue and bpo-40550 are closed. I suggest to open a new issue to enhance the documentation. |