Trait CommandExt

trait CommandExt: Sealed

Os-specific extensions for Command

Required Methods

fn create_pidfd(self: &mut Self, val: bool) -> &mut process::Command

Sets whether a PidFd should be created for the Child spawned by this Command. By default, no pidfd will be created.

The pidfd can be retrieved from the child with pidfd or into_pidfd.

A pidfd will only be created if it is possible to do so in a guaranteed race-free manner. Otherwise, pidfd will return an error.

If a pidfd has been successfully created and not been taken from the Child then calls to kill(), wait() and try_wait() will use the pidfd instead of the pid. This can prevent pid recycling races, e.g. those caused by rogue libraries in the same process prematurely reaping zombie children via waitpid(-1, ...) calls.

Implementors