pub trait CapStdExtCommandExt {
// Required methods
fn take_fd_n(&mut self, fd: Arc<OwnedFd>, target: i32) -> &mut Self;
fn cwd_dir(&mut self, dir: Dir) -> &mut Self;
fn lifecycle_bind_to_parent_thread(&mut self) -> &mut Self;
}Expand description
Extension trait for std::process::Command.
Required Methods§
Sourcefn take_fd_n(&mut self, fd: Arc<OwnedFd>, target: i32) -> &mut Self
fn take_fd_n(&mut self, fd: Arc<OwnedFd>, target: i32) -> &mut Self
Pass a file descriptor into the target process.
Sourcefn cwd_dir(&mut self, dir: Dir) -> &mut Self
fn cwd_dir(&mut self, dir: Dir) -> &mut Self
Use the given directory as the current working directory for the process.
Sourcefn lifecycle_bind_to_parent_thread(&mut self) -> &mut Self
fn lifecycle_bind_to_parent_thread(&mut self) -> &mut Self
On Linux, arrange for [SIGTERM] to be delivered to the child if the
parent thread exits. This helps avoid leaking child processes if
the parent crashes for example.
§IMPORTANT
Due to the semantics of https://man7.org/linux/man-pages/man2/prctl.2.html this will cause the child to exit when the parent thread (not process) exits. In particular this can become problematic when used with e.g. a threadpool such as Tokio’s https://kobzol.github.io/rust/2025/02/23/tokio-plus-prctl-equals-nasty-bug.html.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.