Skip to main content

Module stdin_helper

Module stdin_helper 

Source
Expand description

Stdin reader with configurable timeout to prevent indefinite blocking. Stdin reader with timeout to prevent indefinite blocking when the upstream pipe is held open without sending data.

Used by remember --body-stdin and edit body input to enforce a deadline (default 60s). When the timeout fires, the spawned reader thread is leaked because std::io::stdin() cannot be cancelled from outside; this is acceptable in error scenarios because the process is about to exit anyway.

When stdin is attached to a terminal (interactive TTY), the function returns an AppError::Internal immediately with an actionable message instead of blocking for up to secs seconds waiting for EOF.

Functionsยง

read_stdin_with_timeout
Reads stdin to a String with a hard deadline.