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.

class libtmux-ts latest

Program

A program started by Server.spawn(), running in a pane of its own.

Source and package
Qualified name
Program
Module
program
Package
libtmux
Source
packages/libtmux/src/program.ts
class program.Program

Description#

Drive a full-screen program with Pane.sendKeys() and read its screen with Pane.capture().

It owns its pane. Program.kill(), or leaving an await using scope, ends the program and removes the pane, unless spawned with keep. Should this process exit or die first, tmux ends the program through its lease, unless spawned with orphanAfterMs: null. A kill ends a stream in progress with LibTmuxError, and a pane removed from outside with ObjectNotFoundError. After kill(), output() raises ObjectNotFoundError, stream() raises LibTmuxError, and wait() returns the exit it already saw or raises ObjectNotFoundError.

Requires tmux 3.8 or newer.

Members9#

Common operations7#

  • [Symbol.asyncDispose] method Kill the program when an await using scope ends.
  • kill method End the program and remove its pane, unless kept.
  • output method What the program has printed so far, as its terminal shows it.
  • pane: Pane attribute The pane the program runs in.
  • sessionName: string attribute The session the program runs in: a detached one of its own, removed with it, or with from that pane's session, which loses only the program's window or split. tmux attach -t it to watch the program.
  • stream method Everything the program writes, as UTF-8 text in the order it was written, until it exits and its last write has arrived.
  • wait method 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.

Other members2#

Esc

Type to search.

Reference previewOpen reference