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
- run( argv: readonly string[], options?: Run
Options , ): Promise<ProgramResult > -
Description#
The output is the terminal's, scrollback included, with nothing typed before it. The pane is removed before this returns, whatever happened, unless
keepleaves it for a person to read. Withoutfromits session goes too, and a server with no other session then exits, unless itsexit-emptyoption is off; the next run starts it again.inputgives the program a stdin; otherwise it has only the terminal. A program that never ran, becauseargv[0]was not found or is not executable, orstartDirectorycould not be entered, rejects withProgramStartError, whoseexitCodeis a shell's 127 or 126. A program still running attimeoutMsis ended, SIGTERM and then SIGKILL, and the result hastimedOutset, since the run owns the program; one aborted throughsignalis ended and the call rejects. Should this process die first, tmux itself ends the program and removes its pane withinorphanAfterMs, a minute by default.Requires tmux 3.8 or newer, like
Server.spawn.Examples#
const result = await server.run(["git", "--version"]);result.success; // trueresult.output.startsWith("git version"); // true