skode/transport/port

Erlang Port transport for supervising and communicating with mini-skred as an external OS process over stdin/stdout.

Spawns the native C engine under the BEAM’s standard Port interface, allowing OTP supervisors to monitor its lifecycle and automatically restart it if the engine crashes.

Types

pub type PortProcess

Values

pub fn close(port: PortProcess) -> Nil

Terminate the supervised port process.

pub fn send_chunk(
  port: PortProcess,
  chunk: skode.Chunk,
) -> Result(Nil, String)

Send a single AST Chunk to the engine port.

pub fn send_ops(
  port: PortProcess,
  ops: List(skode.Op),
) -> Result(Nil, String)

Send a list of AST Ops canonically formatted to the engine port.

pub fn send_program(
  port: PortProcess,
  program: List(skode.Chunk),
) -> Result(Nil, String)

Send an entire AST program (List(Chunk)) to the engine port.

pub fn send_text(
  port: PortProcess,
  data: String,
) -> Result(Nil, String)

Send a line of raw Skode text down stdin to the engine.

pub fn spawn(
  executable_path: String,
  args: List(String),
) -> Result(PortProcess, String)

Spawn mini-skred or an engine binary with custom arguments.

pub fn spawn_default() -> Result(PortProcess, String)

Spawn mini-skred found on PATH or current directory with default args.

✨ Search Document