# tmux_program

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** module
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/38478dff54579a4f408005d0265031abdf3a880a/apps/libtmux_erlang/src/tmux_program.erl#L1
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_program/

Run an application in a PTY on a private tmux server.

Pass an absolute path to tmux and a list of binary arguments starting with
the application's absolute path. Releases from tmux 3.8 support the history
counters used in the result. Check the minimum with
`tmux_capability:describe/1` and the feature `program_history`.

`run/3` starts, awaits and releases the program. Use `start/3` when you need
to send input, wait from more than one process or request an early stop.
The caller that starts the program owns its lifetime.

See [Run a program in a private terminal](programs.md) for an executable
example, capture limits and cleanup recovery.

## Members

### Common operations

- [`start/3`](/en/erlang/latest/reference/tmux_program-start-3/) (function): Admit a run and return its handle while native setup continues. The deadline covers setup, execution and capture. Cleanup is collected separately. Eight program slots are shared across each Erlang node.

### Other members

- [`await_started/2`](/en/erlang/latest/reference/tmux_program-await_started-2/) (function): Wait for the launch gate to open. Use `await/2` for the application result.
- [`await/2`](/en/erlang/latest/reference/tmux_program-await-2/) (function): Wait for the result and cleanup receipt. An `await_timeout` leaves the run active.
- [`capture/0`](/en/erlang/latest/reference/t-tmux_program-capture-0/) (typealias): The verified application exit, rendered terminal bytes and cleanup receipt.
- [`history/0`](/en/erlang/latest/reference/t-tmux_program-history-0/) (typealias): The tmux history size, limit, line counters and generation.
- [`options/0`](/en/erlang/latest/reference/t-tmux_program-options-0/) (typealias): Resource limits and environment for an owned launch.
- [`release/1`](/en/erlang/latest/reference/tmux_program-release-1/) (function): Discard a completed result. Native resources with unconfirmed retirement keep their slot.
- [`result/0`](/en/erlang/latest/reference/t-tmux_program-result-0/) (typealias): A completed capture or a structured failure. A nonzero exit can have a complete capture.
- [`run/3`](/en/erlang/latest/reference/tmux_program-run-3/) (function): Start a private terminal, await its result and release the result handle.
- [`send_text/2`](/en/erlang/latest/reference/tmux_program-send_text-2/) (function): Send up to 2,000 literal input bytes to the live program. The program's terminal settings govern how it reads the bytes. A second input request returns `program_input_busy` while the first occupies the input slot.
- [`stop/1`](/en/erlang/latest/reference/tmux_program-stop-1/) (function): Request stop. Use `await/2` to collect the outcome and confirm retirement.
- [`t/0`](/en/erlang/latest/reference/t-tmux_program-t-0/) (typealias): A handle for one owned program and its retained result.
