Description
Is your feature request related to a problem? Please describe.
The current unix implementation of tokio::process
relies on handling SIGCHLD
signals. This requires that the corresponding signal handler be properly set up - if another library in the process modifies it, it will be impossible to properly wait on child processes.
Describe the solution you'd like
On recent versions of Linux, it's possible to use pidfd
s to avoid this problem. Using the recently merged libstd support (rust-lang/rust#81825), we can create a pidfd at the same time that a child is spawned. The pidfd can then be waited on using epoll
or select
(with an optional timeout).
If the running kernel version does not support pidfds, we can fall back to the existing unix implementation.
Describe alternatives you've considered
Do nothing, and continue to use the unix implementation in all cases.