# server.Server.pipeline

- **Module:** server
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/server.ts#L1686
- **Page:** https://libtmux.org/en/ts/latest/reference/server-server-pipeline/

```
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 [`Server.snapshot`](/en/ts/latest/reference/server-server-snapshot/) afterwards if you need to know what
survived.

## Examples

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

## Parameters

- `commands` (`readonly (readonly string[])[]`)
- `options?` (`CommandOptions`)

## Guides

Pages that discuss `pipeline`.

- [Control mode vs one-shot](/en/ts/latest/concepts/transports/)
