Struct process_guard::ProcessGuard [−][src]
pub struct ProcessGuard { /* fields omitted */ }
Protects a process from becoming an orphan or zombie by killing it when the guard is dropped
Methods
impl ProcessGuard
[src]
impl ProcessGuard
pub unsafe fn new(child: Child, grace_time: Option<Duration>) -> ProcessGuard
[src]
pub unsafe fn new(child: Child, grace_time: Option<Duration>) -> ProcessGuard
Create a new child process
unsafe
It is unsafe to put any arbitrary child process into a process guard, mainly because the
guard relies on the child not having been waited on beforehand. Otherwise, it cannot be
guaranteed that the child process has not exited and its PID been reused, potentially
killing an innocent bystander process on Drop
.
pub fn into_inner(self) -> Option<Child>
[src]
pub fn into_inner(self) -> Option<Child>
Retrieves the child process from the process guard
pub fn spawn(cmd: &mut Command) -> Result<ProcessGuard>
[src]
pub fn spawn(cmd: &mut Command) -> Result<ProcessGuard>
Spawns a command
Equivalent to calling cmd.spawn()
, followed by new
.
pub fn spawn_graceful(
cmd: &mut Command,
grace_time: Duration
) -> Result<ProcessGuard>
[src]
pub fn spawn_graceful(
cmd: &mut Command,
grace_time: Duration
) -> Result<ProcessGuard>
Spawns a command with a grace timeout
Equivalent to calling cmd.spawn()
, followed by new
.
Trait Implementations
impl Drop for ProcessGuard
[src]
impl Drop for ProcessGuard
Auto Trait Implementations
impl Send for ProcessGuard
impl Send for ProcessGuard
impl Sync for ProcessGuard
impl Sync for ProcessGuard