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
- wait(options?: Program
Wait ): Promise<ProgramOptions Exit > -
Description#
Giving up leaves the program running: a timeout throws
WaitTimeoutErrorand an abort throwsTmuxTransportErrorof kindcancelled; 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 raisesObjectNotFoundErrorwithin about a second of the kill.Examples#
await using program = await server.spawn(["sh", "-c", "exit 3"]);(await program.wait()).exitCode; // 3- Parameters