Bsdkrun.Client.Shell (bsdkrun_ex v0.3.1)

Copy Markdown View Source

A live interactive shell/exec session, opened by Bsdkrun.Client.shell/3. Output is delivered exactly as configured on shell/3 (mailbox messages by default, or the on_data callback); drive the session with write/2, resize/3 and close/1.

Summary

Functions

Stop delivering output and close the session (idempotent).

Resize the session's pty, so full-screen programs in the guest redraw.

Send input bytes (keystrokes) to the session.

Types

t()

@type t() :: %Bsdkrun.Client.Shell{
  client: Bsdkrun.Client.t(),
  id: String.t(),
  machine_id: String.t(),
  sub_id: String.t(),
  ws_pid: pid()
}

Functions

close(shell)

@spec close(t()) :: :ok | {:error, Bsdkrun.Error.t()}

Stop delivering output and close the session (idempotent).

resize(shell, rows, cols)

@spec resize(t(), non_neg_integer(), non_neg_integer()) ::
  :ok | {:error, Bsdkrun.Error.t()}

Resize the session's pty, so full-screen programs in the guest redraw.

write(shell, data)

@spec write(t(), binary()) :: :ok | {:error, Bsdkrun.Error.t()}

Send input bytes (keystrokes) to the session.