# server.Server.run

- **Module:** server
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/ad09eaef7ffff40f510989ee0695852c44a31576/packages/libtmux/src/server.ts#L1520
- **Page:** https://libtmux.org/en/ts/latest/reference/server-server-run/

```
run(
  argv: readonly string[],
  options?: RunOptions,
): Promise<ProgramResult>
```

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

The output is the terminal's, scrollback included, with nothing typed
before it. The pane is removed before this returns, whatever happened,
unless [`keep`](/en/ts/latest/reference/types-spawnoptions-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`](/en/tmux/latest/catalog/options/exit-empty/) option is off; the next run starts it again.
[`input`](/en/ts/latest/reference/types-spawnoptions-input/) gives the program a stdin; otherwise it has only the terminal.
A program that never ran, because [`argv`](/en/ts/latest/reference/types-plannedoperation-argv/)`[0]` was not found or is not
executable, or `startDirectory` could not be entered, rejects with
[`ProgramStartError`](/en/ts/latest/reference/errors-programstarterror/), whose `exitCode` is a shell's 127 or 126.
A program still running at [`timeoutMs`](/en/ts/latest/reference/server-serveroptions-timeoutms/) is ended, SIGTERM and then
SIGKILL, and the result has [`timedOut`](/en/ts/latest/reference/types-programresult-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`](/en/ts/latest/reference/types-spawnoptions-orphanafterms/), a minute by default.

Requires tmux 3.8 or newer, like [`Server.spawn`](/en/ts/latest/reference/server-server-spawn/).

## Examples

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

## Parameters

- `argv` (`readonly string[]`)
- `options?` (`RunOptions`)
