Skip to content

Stdin

Handle for the process's standard input, obtained as shell.stdin.

Methods

read size?

Reads raw bytes.

Parameters:

Name Type Description
size Int? Maximum bytes to read; unbounded when omitted

Returns: Bin. Empty means end of stream.

With a size, this is a single read and may return fewer bytes than requested, as fs.File.read does. Without one, it reads to end of stream.

let rest = shell.stdin.read()
let head = shell.stdin.read 64

Operators

Iteration

Stdin is an iterator. Iteration is framed per the ambient I/O mode: :LINE: yields Str values with the line ending removed, :CHUNK: yields Bin values.

for line = shell.stdin
  if (line == "--")
    break
let body = shell.stdin.read()