Terminalwire.Server.IO (Terminalwire v0.1.0)

Copy Markdown View Source

An Erlang I/O-protocol device backed by a Terminalwire session. Set as the CLI handler's group leader (see Terminalwire.Server.Session), it routes the standard IO — IO.puts/IO.gets/IO.write, IO.ANSI, :io.columns, and any library built on them (e.g. Owl) — over the wire to the client's terminal, with no Context threading. This mirrors the Ruby server's Server.redirect, which points $stdout/$stdin at the client.

  • put_chars → the client's stdout stream (flow-controlled by the session)
  • get_line/get_until/get_chars → a line from the client's stdin
  • get_geometry → the client's live terminal size (kept current on resize)

stderr is NOT routed here — in Erlang it's a separate named device, not the group leader. Use Context.warn/2 for stderr.

Summary

Functions

Returns a specification to start this module under a supervisor.

Push the client's new terminal size after a resize (keeps :io.columns live).

Start a device bound to session, seeded with the client's terminal size.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

resized(io, cols, rows)

Push the client's new terminal size after a resize (keeps :io.columns live).

start_link(session, cols, rows)

Start a device bound to session, seeded with the client's terminal size.