Pane.waitForCommand
Resolve with the exit status of the next command this pane's shell finishes.
Source and package
- Qualified name
-
Pane.wait For Command - 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 apane-command-finishedevent.sendtypes 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 atimeoutMs, whoseWaitTimeoutErrornames the marks as the likely cause. A pane whose program has exited rejects withLibTmuxError. The mark carries a status alone; what the command printed is on the pane, forPane.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