Skip to main content

read_stdin_with_timeout

Function read_stdin_with_timeout 

Source
pub fn read_stdin_with_timeout(secs: u64) -> Result<String, AppError>
Expand description

Reads stdin to a String with a hard deadline.

Returns AppError::Internal immediately when stdin is attached to a terminal (TTY) — the caller must redirect data via a pipe or file.

§Errors

Returns AppError::Internal when stdin is a TTY, when the read does not finish within secs seconds, or AppError::Io when the underlying read fails.