pub struct ScopedChild { /* private fields */ }Expand description
RAII handle wrapping a spawned Child with registry tracking.
Implementations§
Source§impl ScopedChild
impl ScopedChild
Sourcepub fn spawn(command: &mut Command) -> Result<Self>
pub fn spawn(command: &mut Command) -> Result<Self>
Spawn the command and register the resulting child’s PID.
Sourcepub fn spawn_process_tree(command: &mut Command) -> Result<Self>
pub fn spawn_process_tree(command: &mut Command) -> Result<Self>
Spawn a subprocess wrapper in a dedicated process tree and register the tree for process-wide signal cleanup.
Sourcepub fn process_tree_terminator(&self) -> Option<ProcessTreeTerminator>
pub fn process_tree_terminator(&self) -> Option<ProcessTreeTerminator>
Return a cloneable handle that terminates the owned tree, or the direct child when it inherited a tree from a Fallow parent.
Sourcepub fn id(&self) -> u32
pub fn id(&self) -> u32
OS-level process id of the underlying child. Returns 0 if the
child has been consumed.
Sourcepub fn take_stdin(&mut self) -> Option<ChildStdin>
pub fn take_stdin(&mut self) -> Option<ChildStdin>
Take the child’s stdin handle, if it was piped. Same semantics
as Child::stdin.take(). Returns None if stdin was not piped
or the child has been consumed.
Sourcepub fn take_stdout(&mut self) -> Option<ChildStdout>
pub fn take_stdout(&mut self) -> Option<ChildStdout>
Take the child’s stdout handle, if it was piped. Same semantics as
Child::stdout.take(). Returns None if stdout was not piped or the
child has been consumed. Used by long-lived readers (e.g. the audit
base-file cat-file --batch reader) that drive both pipes while leaving
the wrapper owning the child for registry tracking and the terminal wait.
Sourcepub fn take_stderr(&mut self) -> Option<ChildStderr>
pub fn take_stderr(&mut self) -> Option<ChildStderr>
Take the child’s stderr handle, if it was piped. Same semantics as
Child::stderr.take().
Sourcepub fn wait_with_output(self) -> Result<Output>
pub fn wait_with_output(self) -> Result<Output>
Consume self and wait for the child to exit, collecting stdout and stderr. The signal handler may have already killed the child via the registered termination target; in that case wait returns normally with a non-zero status.
Sourcepub fn wait(self) -> Result<ExitStatus>
pub fn wait(self) -> Result<ExitStatus>
Wait for the child to exit, returning the status. Same signal-cleanup
semantics as wait_with_output.