pub struct ChildProcess { /* private fields */ }Expand description
A child process this agent started.
04-subsystem-contracts.md: “local process state is authoritative only for
a child process owned by this agent”. That is this type. For a process
recovered from the journal after a restart there is no Child and no
parent relationship, so ProcessIdentity is the authority instead.
Implementations§
Source§impl ChildProcess
impl ChildProcess
Sourcepub const fn identity(&self) -> &ProcessIdentity
pub const fn identity(&self) -> &ProcessIdentity
The identity to record in the journal.
Sourcepub fn is_running(&mut self) -> Result<bool, ProcessError>
pub fn is_running(&mut self) -> Result<bool, ProcessError>
Sourcepub fn try_exit_status(&mut self) -> Result<Option<ExitStatus>, ProcessError>
pub fn try_exit_status(&mut self) -> Result<Option<ExitStatus>, ProcessError>
The child’s exit status if it has already exited, reaping it if so.
§Errors
ProcessError::Control when the wait fails.
Sourcepub fn wait(&mut self) -> Result<ExitStatus, ProcessError>
pub fn wait(&mut self) -> Result<ExitStatus, ProcessError>
Sourcepub fn wait_for(
&mut self,
timeout: Duration,
) -> Result<Option<ExitStatus>, ProcessError>
pub fn wait_for( &mut self, timeout: Duration, ) -> Result<Option<ExitStatus>, ProcessError>
Waits up to timeout for the child to exit; None means it is still
running when the timeout expires.
§Errors
ProcessError::Control when the wait fails.
Sourcepub fn stop(&mut self, grace: Duration) -> Result<ExitStatus, ProcessError>
pub fn stop(&mut self, grace: Duration) -> Result<ExitStatus, ProcessError>
Asks the child to stop, forcefully if grace expires first.
See ProcessIdentity::terminate for what grace means on each
platform. Unlike that method this one has the parent relationship, so it
reaps the child and returns its exit status.
§Errors
ProcessError::Control when signalling or waiting fails.
Sourcepub fn take_stdout(&mut self) -> Option<ChildStdout>
pub fn take_stdout(&mut self) -> Option<ChildStdout>
Takes the captured standard output, if OutputMode::Capture was set.
Sourcepub fn take_stderr(&mut self) -> Option<ChildStderr>
pub fn take_stderr(&mut self) -> Option<ChildStderr>
Takes the captured standard error, if OutputMode::Capture was set.