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-from-stdin and edit body input to enforce a
deadline (crate::constants::DEFAULT_STDIN_READ_TIMEOUT_SECS, override
via XDG cli.stdin_timeout_secs). 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.
Two refusals happen before any read is attempted:
--no-input(or XDGcli.no_input) makes the refusal DECLARATIVE — it holds even when a pipe is attached and would have supplied data;- an interactive TTY makes it EMERGENT — there is no producer, so waiting for EOF would just burn the whole deadline.
Functions§
- install_
no_ input - Installs the resolved
--no-inputdecision for the whole process. - no_
input - Whether stdin reads are refused for this invocation.
- read_
stdin - Reads stdin to a
Stringwith the configured deadline. - read_
stdin_ with_ timeout - Reads stdin to a
Stringwith a hard deadline.