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

Server.run

Run a program to completion in a pane of its own and return what it printed.

Source and package
Qualified name
Server.run
Module
server
Declared in
Server
Package
libtmux
Source
packages/libtmux/src/server.ts

Description#

The output is the terminal's, scrollback included, with nothing typed before it. The pane is removed before this returns, whatever happened, unless keep leaves it for a person to read. Without from its session goes too, and a server with no other session then exits, unless its exit-empty option is off; the next run starts it again. input gives the program a stdin; otherwise it has only the terminal. A program that never ran, because argv[0] was not found or is not executable, or startDirectory could not be entered, rejects with ProgramStartError , whose exitCode is a shell's 127 or 126. A program still running at timeoutMs is ended, SIGTERM and then SIGKILL, and the result has timedOut set, since the run owns the program; one aborted through signal is ended and the call rejects. Should this process die first, tmux itself ends the program and removes its pane within orphanAfterMs , a minute by default.

Requires tmux 3.8 or newer, like Server.spawn .

Examples#

const result = await server.run(["git", "--version"]);
result.success; // true
result.output.startsWith("git version"); // true
Parameters
Esc

Type to search.

Reference previewOpen reference