# tmux_pane:pipe/3

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_pane.erl#L165
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_pane-pipe-3/

```
pipe/3
-spec pipe(tmux_model:pane(),
           pipe_command(),
           pipe_options()) ->
              {ok, map()} | {error, map()}.
```

Connect a shell process to this registered physical pane, performing I/O. An explicit nonempty `#{shell => Command}` is required (`t:pipe_command/0`). tmux hash formats and strftime directives are escaped so the shell receives the supplied text. This does not quote values interpolated into shell code; the caller owns that quoting. Executable argv is not accepted by this shell-only native command. Encoding follows `tmux_command:literal_format/2` in time mode. A percent-bearing command above its native 8191-byte intermediate limit returns `format_limit` before dispatch, preserving any existing pipe.

`direction` (`t:pipe_options/0`) is `output` (default: pane output to child
stdin), `input` (child stdout to pane input) or `both`. `toggle` defaults false,
replacing any existing pipe. True maps to native `-o`: close an existing pipe without
starting another, or open one when none exists. A stopped pipe and replacement
can discard pending output. Await consumer acknowledgements before closing
if delivered bytes matter. This is a live PTY byte stream, not rendered
capture text or replay of terminal history; terminal modes affect its bytes.

The child is started by tmux through `/bin/sh -c`. Its stderr is discarded;
unused directions are routed to the native null device. No pane cwd or
environment copying is promised. A successful command result does not prove
exec success, readiness, delivery or child exit. The process is tmux-owned;
`tmux_server:close/1` preserves the borrowed pane and its pipe. This is not an
Erlang subscription with library flow control. Use `stop_pipe/1` to close the
pipe; stopping is not process cancellation or a wait for job completion.

## Parameters

- `Pane` (`tmux_model:pane()`)
- `Command` (`pipe_command()`)
- `Options` (`pipe_options()`)

## tmux command

The tmux commands behind `pipe/3`.

- [`pipe-pane`](/en/tmux/latest/manual/pipe-pane/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_pipe_pane_entry`](/en/tmux/latest/reference/c-variable-cmd_pipe_pane_entry/) (attribute)
- [`cmd_pipe_pane_exec`](/en/tmux/latest/reference/c-function-cmd-pipe-pane-c-cmd_pipe_pane_exec/) (function)

## Guides

Pages that discuss `pipe/3`.

- [Native API documentation](/en/erlang/latest/guides/api-documentation/)
- [Pipe pane output](/en/erlang/latest/guides/piping/)

## In other ports

Copy a pane's output to a shell command

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Pane.pipe`](/en/py/latest/reference/libtmux-pane-pipe/) (method) |
| Ruby | [`LibTmux::Pane#pipe`](/en/ruby/latest/reference/libtmux-pane-pipe/) (method) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`pane.Pane.pipeTo`](/en/ts/latest/reference/pane-pane-pipeto/) (method) |
| Rust | [`pane.Pane.pipe`](/en/rs/latest/reference/pane-pane-pipe/) (method) |
| Go | [`tmux.Pane.Pipe`](/en/go/latest/reference/tmux-pane-pipe/) (method) |
| Java | [`io.github.libtmux.Pane.pipeTo`](/en/java/latest/reference/io-github-libtmux-pane-pane-pipeto/) (method) |
| C# | [`LibTmux.Pane.PipeAsync`](/en/csharp/latest/reference/libtmux-pane-pipeasync/) (method) |
| C++ | [`libtmux::Pane::pipe_to`](/en/cxx/latest/reference/libtmux-pane-pipe_to/) (method) |
| Swift | [`Server.pipe(_:to:)`](/en/swift/latest/reference/server-pipe(_-to-)/) (method) |
| OCaml | No direct public OCaml equivalent is recorded for this operation. |
| Perl | No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands. |

No equivalent is recorded in Lua, PowerShell, Julia, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.
