Core Library0.xAPI Reference

Choose documentation 3

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.

method libtmux-ts latest

Pane.waitForCommand

Resolve with the exit status of the next command this pane's shell finishes.

Source and package
Qualified name
Pane.waitForCommand
Module
pane
Declared in
Pane
Package
libtmux
Source
packages/libtmux/src/pane.ts

Description#

Needs a shell that marks each command's end with OSC 133 (ESC ] 133 ; D ; status) from its prompt; tmux turns the mark into a pane-command-finished event. send types a command line once the wait is listening, so a command that ends at once is not missed. A shell's first prompt marks an end too, before any command ran, so a wait armed while the shell starts can resolve with 0. A shell without the marks never resolves this: give it a timeoutMs, whose WaitTimeoutError names the marks as the likely cause. A pane whose program has exited rejects with LibTmuxError . The mark carries a status alone; what the command printed is on the pane, for Pane.capture .

Requires tmux 3.8 or newer.

Examples#

const status = await pane.waitForCommand({ send: "make test", timeoutMs: 600_000 });
status; // 0 when the tests passed
Parameters
Esc

Type to search.

Reference previewOpen reference