Files
wren/doc/site/modules/io/stdin.markdown
T
Bob Nystrom 67bf74777c feat: add Stdin.isTerminal method to detect TTY connection
Add a new `isTerminal` static method to the Stdin class that returns `true` when
stdin is connected to a TTY (interactive terminal) and `false` when input comes
from a pipe. Implementation uses libuv's `uv_guess_handle` to check the stdin
descriptor. Includes documentation, foreign method declaration, module
registration, and a test expecting `false` since tests run non-interactively.
2016-05-21 19:51:11 +00:00

877 B

^title Stdin Class

The standard input stream.

Static Methods

isRaw

Returns true if stdin is in raw mode. When in raw mode, input is not echoed or buffered, and all characters, even non-printing and control characters go into stdin.

Defaults to false.

isRaw=(value)

Sets raw mode on or off.

isTerminal

Returns true if Stdin is connected to a "TTY". This is true when the user is running Wren in an interactive terminal, and false if it its input is coming from a pipe.

readByte()

Reads one byte of input from stdin. Blocks the current fiber until a byte has been received.

Returns the byte value as a number or null if stdin is closed.

readLine()

Reads one line of input from stdin. Blocks the current fiber until a full line of input has been received.

Returns the string of input or null if stdin is closed.