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 take(&mut self) -> Option<Child>
[src]
pub fn take(&mut 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
.
pub fn shutdown(&mut self) -> Result<Option<ExitStatus>>
[src]
pub fn shutdown(&mut self) -> Result<Option<ExitStatus>>
Shut the process down
Calling shutdown()
on a guard whose process has already exited is a no-op. Note that
a process whose shutdown failed is also considered shutdown, even though it might still be
running.
Trait Implementations
impl Debug for ProcessGuard
[src]
impl Debug for ProcessGuard
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
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