pub struct ChildWrapper { /* private fields */ }
Expand description

Wraps a std::process::Child to coordinate state between std and wait_timeout.

This is necessary because the completion of a call to wait_timeout::ChildExt::wait_timeout leaves the Child in an inconsistent state, as it does not know the child has exited, and on Unix may end up referencing another process.

Documentation for this struct’s methods is largely copied from the Rust std docs.

Implementations

Return a reference to the inner std::process::Child.

Use care on the returned object, as it does not necessarily reference the correct process unless you know the child process has not exited and no wait calls have succeeded.

Return a mutable reference to the inner std::process::Child.

Use care on the returned object, as it does not necessarily reference the correct process unless you know the child process has not exited and no wait calls have succeeded.

Forces the child to exit. This is equivalent to sending a SIGKILL on unix platforms.

If the process has already been reaped by this handle, returns a NotFound error.

Returns the OS-assigned processor identifier associated with this child.

This succeeds even if the child has already been reaped. In this case, the process id may reference no process at all or even an unrelated process.

Waits for the child to exit completely, returning the status that it exited with. This function will continue to have the same return value after it has been called at least once.

The stdin handle to the child process, if any, will be closed before waiting. This helps avoid deadlock: it ensures that the child does not block waiting for input from the parent, while the parent waits for the child to exit.

If the child process has already been reaped, returns its exit status without blocking.

Attempts to collect the exit status of the child if it has already exited.

This function will not block the calling thread and will only advisorily check to see if the child process has exited or not. If the child has exited then on Unix the process id is reaped. This function is guaranteed to repeatedly return a successful exit status so long as the child has already exited.

If the child has exited, then Ok(Some(status)) is returned. If the exit status is not available at this time then Ok(None) is returned. If an error occurs, then that error is returned.

Simultaneously waits for the child to exit and collect all remaining output on the stdout/stderr handles, returning an Output instance.

The stdin handle to the child process, if any, will be closed before waiting. This helps avoid deadlock: it ensures that the child does not block waiting for input from the parent, while the parent waits for the child to exit.

By default, stdin, stdout and stderr are inherited from the parent. (In the context of rusty_fork, they are by default redirected to a file.) In order to capture the output into this Result<Output> it is necessary to create new pipes between parent and child. Use stdout(Stdio::piped()) or stderr(Stdio::piped()), respectively.

If the process has already been reaped, returns a NotFound error.

Wait for the child to exit, but only up to the given maximum duration.

If the process has already been reaped, returns its exit status immediately. Otherwise, if the process terminates within the duration, returns Ok(Sone(..)), or Ok(None) otherwise.

This is only present if the “timeout” feature is enabled.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.