pub trait ExecExt {
// Required methods
fn setuid(self, uid: u32) -> Self;
fn setgid(self, gid: u32) -> Self;
fn setpgid(self) -> Self;
}Expand description
Extension trait for Unix-specific process creation options.
Required Methods§
Sourcefn setuid(self, uid: u32) -> Self
fn setuid(self, uid: u32) -> Self
Set the user ID for the spawned process.
The child process will run with the specified user ID, which affects file
access permissions and process ownership. This calls setuid(2) in the child
process after fork() but before exec().
Sourcefn setgid(self, gid: u32) -> Self
fn setgid(self, gid: u32) -> Self
Set the group ID for the spawned process.
The child process will run with the specified group ID, which affects file
access permissions based on group ownership. This calls setgid(2) in the
child process after fork() but before exec().
Sourcefn setpgid(self) -> Self
fn setpgid(self) -> Self
Put the subprocess into its own process group.
This calls setpgid(0, 0) before execing the child process, making it the
leader of a new process group. Useful for a single process that spawns
children, allowing them all to be signaled as a group with
ProcessExt::send_signal_group.
For pipelines, use PipelineExt::setpgid instead, which puts all pipeline
processes into a shared group.
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.