term.read_key

term

read_key(reader, opts) -> ... (same tuple as get())

Cooperatively read one key/sequence from a lev fd reader

Like get(), but pulls bytes from a lev.fd_reader (typically over stdin, fd 0) instead of blocking on io.read. Yields to the event loop until a full key/sequence arrives, so other tasks keep running while waiting. opts is forwarded to the reader's read() (e.g. { cancel = token }); when the read is cancelled/closed it returns nil. KKBP sequences split across multiple reads are reassembled correctly.