stdin.ts

The stdin host module: the running process's standard input, as an import rather than a global.

Handles and their prototypes are frozen, null-prototype so none of them is thenable even with a polluted Object.prototype.then, and constructing one takes a key only this module holds. A method called on any other object throws TypeError, private fields being the only state.

This is the Node implementation, which runs on the Node Gro. Its gaps against the runtime's builtin, which it documents rather than the API weakening to match:

  • The global process stays, and any module can read process.stdin.
  • Intrinsics stay pollutable. The stream classes and EventEmitter.prototype (emit) stay, so code that patches them runs inside these ops holding the raw stream.
  • A chunk read from stdin passes through Node's iterator, so a polluted then can replace it.
view source

Declarations
#

2 declarations

ProcessInput
#

stdin.ts view source

ProcessInput import type {ProcessInput} from '@fuzdev/gro/stdin.js';

The process's stdin.

inheritance

extends: AsyncIterable<Uint8Array>

is_terminal

Whether stdin is a terminal.

type boolean

readonly

stdin
#

stdin.ts view source

ProcessInput import {stdin} from '@fuzdev/gro/stdin.js';

Stdin. Iterating is once only and reads bytes as plain Uint8Array copies, a second iteration throwing TypeError. Leaving a loop early stops reading.

Depends on
#