pub struct DtactChild { /* private fields */ }Expand description
A spawned child process.
wait/wait_with_output consume self (ownership transfers into the
pool closure, so nothing needs to be shared or locked); kill/id
are synchronous since they’re fast, non-blocking syscalls.
Implementations§
Source§impl DtactChild
impl DtactChild
Sourcepub fn kill(&mut self) -> Result<()>
pub fn kill(&mut self) -> Result<()>
Send SIGKILL (Unix) / TerminateProcess (Windows) to the child.
§Errors
Returns an error if the OS kill syscall fails — in practice this is
almost always because the process had already exited (the
underlying std::process::Child::kill documents this as the
common failure case; it is not itself treated as success).
Sourcepub fn take_stdin(&mut self) -> Option<DtactChildStdin>
pub fn take_stdin(&mut self) -> Option<DtactChildStdin>
Take ownership of the child’s stdin, if it was configured with
Stdio::piped(). Can only be taken once.
Sourcepub fn take_stdout(&mut self) -> Option<DtactChildStdout>
pub fn take_stdout(&mut self) -> Option<DtactChildStdout>
Take ownership of the child’s stdout, if it was configured with
Stdio::piped(). Can only be taken once.
Sourcepub fn take_stderr(&mut self) -> Option<DtactChildStderr>
pub fn take_stderr(&mut self) -> Option<DtactChildStderr>
Take ownership of the child’s stderr, if it was configured with
Stdio::piped(). Can only be taken once.
Sourcepub async fn wait(self) -> Result<ExitStatus>
pub async fn wait(self) -> Result<ExitStatus>
Block (on the process pool, not the calling task’s thread) until the child exits.
§Errors
Returns whatever std::process::Child::wait returns — an I/O
error if waiting on the OS process handle itself fails (rare; not
the same as the child exiting non-zero, which is a normal Ok
with a non-zero ExitStatus).
Sourcepub async fn wait_with_output(self) -> Result<Output>
pub async fn wait_with_output(self) -> Result<Output>
Wait for exit and collect stdout/stderr in one shot — the std-library convenience, dispatched to the pool the same way.
§Errors
Same as Self::wait: an I/O error only if waiting on the OS
process handle or reading its piped stdout/stderr fails, not for a
non-zero exit status.