Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: More detail on timeouts #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Command {
self
}

/// Error out if a timeout is reached
/// Error out if a timeout is reached.
///
/// ```rust,no_run
/// use assert_cmd::Command;
Expand All @@ -96,9 +96,13 @@ impl Command {
/// .unwrap()
/// .timeout(std::time::Duration::from_secs(1))
/// .env("sleep", "100")
/// .assert();
/// assert.failure();
/// .assert()
/// .interrupted() // Child was interrupted.
/// .failure(); // More generally a timeout is a type of failure.
/// ```
///
/// If the process does not complete before the timeout then it will be terminated
/// using [std::process::Child::kill], which on Unix sends a `SIGKILL`.
pub fn timeout(&mut self, timeout: std::time::Duration) -> &mut Self {
self.timeout = Some(timeout);
self
Expand Down