libtmux Reference MCP Search
On this page

tmux.Pane.Capture

View as Markdown

Module
tmux
Declared in
Pane
Package
github.com/libtmux/libtmux-go/tmux
Source
tmux/pane_capture.go
Other languages
PythonTypeScriptRustJava.NETC++Swift
Capture ( ctx : context.Context , request : CapturePaneRequest ) ([]string, error)
method [source]
method [source]
Capture

Capture captures printed content from the receiver's exact linked pane. It returns a caller-owned slice. A completed nonzero exit or stderr does not become a CommandError ; any stdout is returned without an error.

This is a point-in-time capture rather than a stream; the zero request reads the visible screen. It may include a shell's echo of Pane.SendKeys input. Compare whole lines when polling; use ControlClient.NextNotification or Server.WaitFor when the application exposes a stream or explicit signal.

Invalid positions fail before execution. Transport and context failures return any partial stdout with the error.

In other languages Read a pane’s visible contents

Examples

>>> pane = window.split(shell='sh')
>>> pane.capture_pane()
['$']
>>> pane.send_keys('echo "Hello world"', enter=True)
>>> pane.capture_pane()
['$ echo "Hello world"', 'Hello world', '$']
>>> print(chr(10).join(pane.capture_pane()))
$ echo "Hello world"
Hello world
$
const lines = await pane.capture();
lines.at(-1);

0 declared, 0 inherited

Esc

Type to search.