Core Library0.xAPI reference

Choose documentation 1

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice

function libtmux-erlang

tmux_pane:wait_exit/2

Wait for a retained pane's process. Return its native status or signal (exit/0) and a fresh pane row. Set remain-on-exit to on before starting a job whose exit you need. A live pane with another setting returns remain_on_exit_required.

Source and package
Qualified name
tmux_pane:wait_exit/2
Declared in
tmux_pane
Package
libtmux_erlang
Source
apps/libtmux_erlang/src/tmux_pane.erl
wait_exit(Pane, Options) -spec wait_exit(tmux_model:pane(), wait_exit_options()) -> {ok, wait_exit_result()} | {error, map()}.

Description

A live wait binds the process and pins its PTY allocation. The owner holds that pin through the final read without consuming terminal bytes. Respawn returns stale_pane and replacement of the daemon returns stale_server. An exit already published at the first read is a current observation. The fast path has no live-generation pin.

On tmux 3.8, the wait uses a filtered native pane-died event. On older supported daemons, it registers a private indexed hook and channel. Both paths recheck native state before acting on an exit notification. Keep the endpoint open through cleanup. The supervised owner retires the wait client when the call ends or its caller dies. A native unset failure can leave a legacy hook installed.

deadline_ms bounds the native wait, starting after the initial observation. Setup readiness and cleanup waits each have a 900 ms limit. State probes and final capture each use their own 2,500 ms command budget. Client retirement can add its cleanup allowance.

  • deadline means the wait reached its bound. A still-running pane can be waited on again.
  • exit_status_unavailable means the original process exited and tmux has yet to publish a native status or signal.
  • pane_generation_unavailable means the wait could not bind its original process and terminal.
  • target_gone means the pane disappeared.

See pane-exit errors for remedies. To capture a job's final screen, use the job guide pattern that acknowledges terminal parsing before exit.

Invalid options fail before I/O.

Examples

1> tmux_pane:wait_exit(invalid_row, #{deadline_ms => 0}).
{error,#{code => invalid_option,path => [deadline_ms]}}

Recorded calls

source calls
No call edges in the Erlang model.

The Erlang reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls tmux_pane:wait_exit/2.

tmux command

task material

The tmux commands behind wait_exit/2.

tmux C API

task material

The C declarations in tmux that implement these commands.

Guides

task material

Pages that discuss wait_exit/2.

Esc
Search in

Type to search.

Reference previewOpen reference