Skip to main content

Module stdin_drain

Module stdin_drain 

Source
Expand description

Detect and drain leftover stdin after a multi-line paste.

Terminals treat newlines in a paste as Enter, so the first prompt only sees the first line. Remaining lines must be consumed before the next prompt.

Functionsยง

drain_available_stdin_lines
Splits available stdin data into non-empty logical lines.
read_available_stdin_bytes
Reads all currently available stdin bytes without blocking when empty.
read_pastable_line
Reads a task name from stdin, absorbing multi-line paste into one string.
stdin_has_pending_input
Returns true when stdin has data that can be read without waiting for the user.