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

Program.wait

Resolve with how the program ended, once it has. The pane stays, for Program.output(), until Program.kill() or await using. A program that never ran, because argv[0] was not found or is not executable, or startDirectory could not be entered, rejects every wait with ProgramStartError, and its stream ends with it.

Source and package
Qualified name
Program.wait
Module
program
Declared in
Program
Package
libtmux
Source
packages/libtmux/src/program.ts

Description#

Giving up leaves the program running: a timeout throws WaitTimeoutError and an abort throws TmuxTransportError of kind cancelled; with neither it waits as long as the program runs. A pane killed from outside fires no event, so the wait reads its pane every second and raises ObjectNotFoundError within about a second of the kill.

Examples#

await using program = await server.spawn(["sh", "-c", "exit 3"]);
(await program.wait()).exitCode; // 3
Parameters
Esc

Type to search.

Reference previewOpen reference