Trait process_control::Timeout
source · [−]pub trait Timeout: Sealed {
type Result;
fn strict_errors(self) -> Self;
fn terminating(self) -> Self;
fn wait(self) -> Result<Option<Self::Result>>;
}use Control instead
Expand description
A temporary wrapper for a process timeout.
Associated Types
Required methods
fn strict_errors(self) -> Self
fn strict_errors(self) -> Self
use Control::strict_errors instead
Causes wait to never suppress an error.
Typically, errors terminating the process will be ignored, as they are often less important than the result. However, when this method is called, those errors will be returned as well.
fn terminating(self) -> Self
fn terminating(self) -> Self
use Control::terminate_for_timeout instead
Causes the process to be terminated if it exceeds the time limit.
Process identifier reuse by the system will be mitigated. There should never be a scenario that causes an unintended process to be terminated.
use Control::wait instead
Runs the process to completion, aborting if it exceeds the time limit.
At least one thread will be created to wait on the process without blocking the current thread.
If the time limit is exceeded before the process finishes, Ok(None)
will be returned. However, the process will not be terminated in that
case unless terminating is called beforehand. It is recommended to
always call that method to allow system resources to be freed.
The stdin handle to the process, if it exists, will be closed before waiting. Otherwise, the process would assuredly time out when reading from that pipe.
This method cannot guarantee that the same io::ErrorKind variants
will be returned in the future for the same types of failures. Allowing
these breakages is required to enable calling Child::kill
internally.