Raw codex CLI subprocess session backed by CliSubprocessCore.Channel.
One-shot non-PTY command wrappers should use Codex.CLI.run/2, which
executes through the shared CliSubprocessCore.Command lane.
Sessions are useful for interactive or long-running commands such as:
codexcodex resumecodex forkcodex app-servercodex mcp-server
The caller process continues to receive the historical mailbox events:
{:stdout, os_pid, binary}{:stderr, os_pid, binary}{:DOWN, os_pid, :process, pid, reason}
Use collect/2 to accumulate output until the process exits.
Summary
Functions
Closes the subprocess stdin by sending EOF.
Collects stdout/stderr until the subprocess exits.
Interrupts the subprocess.
Sends input bytes to the subprocess stdin.
Starts a raw subprocess session for a resolved Codex program and args.
Stops the subprocess.
Types
@type t() :: %Codex.CLI.Session{ args: [String.t()], channel: CliSubprocessCore.Channel.t(), command: [String.t()], os_pid: non_neg_integer(), pid: pid(), pty?: boolean(), receiver: pid(), stdin?: boolean() }
Functions
Closes the subprocess stdin by sending EOF.
Collects stdout/stderr until the subprocess exits.
Interrupts the subprocess.
Sends input bytes to the subprocess stdin.
@spec start(String.t() | CliSubprocessCore.CommandSpec.t(), [String.t()], keyword()) :: {:ok, t()} | {:error, term()}
Starts a raw subprocess session for a resolved Codex program and args.
@spec stop(t()) :: :ok
Stops the subprocess.