pub struct Child { /* private fields */ }process only.Expand description
A child process spawned with Command
Implementations§
Source§impl Child
impl Child
Sourcepub fn wait_nz(self) -> Result<()>
pub fn wait_nz(self) -> Result<()>
Block the thread and wait for the child to finish, and check if the ExitStatus is 0
Note that currently any error that occurred in input/output tasks are treated as warning and not hard error.
§Blocking
This will block the current thread while trying to join the child.
Use co_wait_nz to avoid blocking if in async context.
Sourcepub fn wait(self) -> Result<ExitStatus>
pub fn wait(self) -> Result<ExitStatus>
Block the thread and wait for the child to finish,
and return its ExitStatus
Note that currently any error that occurred in input/output tasks are treated as warning and not hard error.
§Blocking
This will block the current thread while trying to join the child.
Use co_wait to avoid blocking if in async context.
Sourcepub async fn co_wait_nz(self) -> Result<()>
pub async fn co_wait_nz(self) -> Result<()>
Wait for the child asynchronously using the current tokio runtime, and check if the ExitStatus is 0.
Note that currently any error that occurred in input/output tasks are treated as warning and not hard error.
§Panic
Will panic if called outside of a tokio runtime context
Sourcepub async fn co_wait(self) -> Result<ExitStatus>
pub async fn co_wait(self) -> Result<ExitStatus>
Wait for the child asynchronously using the current tokio runtime,
and return its ExitStatus
Note that currently any error that occurred in input/output tasks are treated as warning and not hard error.
§Panic
Will panic if called outside of a tokio runtime context
Sourcepub fn wait_guard(self) -> ChildWaitGuard
pub fn wait_guard(self) -> ChildWaitGuard
Create a wait guard that will automatically wait for the child (and ignore the error) when going out of scope.
Sourcepub async fn co_wait_timeout(
&mut self,
timeout: Duration,
) -> Result<Option<ExitStatus>>
pub async fn co_wait_timeout( &mut self, timeout: Duration, ) -> Result<Option<ExitStatus>>
Wait for the child to exit for at least the timeout. Return the exit status if exited
pub fn wait_timeout(&mut self, timeout: Duration) -> Result<Option<ExitStatus>>
Sourcepub async fn co_kill(self) -> Result<ExitStatus>
pub async fn co_kill(self) -> Result<ExitStatus>
Kill the child and wait for it to exit asynchronously. Return the exit status
§Panic
Will panic if called outside of a tokio runtime context