Trait no_std_compat::os::linux::process::CommandExt
source · pub trait CommandExt: Sealed {
// Required method
fn create_pidfd(&mut self, val: bool) -> &mut Command;
}
🔬This is a nightly-only experimental API. (
linux_pidfd
)Available on Linux only.
Expand description
Os-specific extensions for Command
Required Methods§
sourcefn create_pidfd(&mut self, val: bool) -> &mut Command
🔬This is a nightly-only experimental API. (linux_pidfd
)
fn create_pidfd(&mut self, val: bool) -> &mut Command
linux_pidfd
)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.