# server.Server.pipeline

- **Module:** server.Server
- **Package:** @libtmux/libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/2cb93308200da38a26b59876618116850f110607/packages/libtmux/src/server.ts#L1002
- **Page:** https://libtmux.org/reference/ts/server-server-pipeline/

```
server.Server.pipeline(commands: : readonly (readonly string[])[], options: : CommandOptions) -> Promise<readonly (readonly string[])[]>
```

Run several tmux commands in order.

The result is positional: `results[i]` holds what `commands[i]` printed,
empty for a command that prints nothing. Commands run as separate tmux
invocations because arbitrary command output has no alias-independent
delimiter.

Not atomic. tmux runs the commands in order and stops at the first failure,
leaving everything before it applied; the error names the command that
failed. Take a {@link Server.snapshot} afterwards if you need to know what
survived.

## Example

```ts
const [[first], [second]] = await server.pipeline([
  ["new-window", "-d", "-P", "-F", "#{window_id}"],
  ["new-window", "-d", "-P", "-F", "#{window_id}"],
]);
```
