On this page
tmux.Pane.Capture
- 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)
-
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.SendKeysinput. Compare whole lines when polling; useControlClient.NextNotificationorServer.WaitForwhen 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
- Python
libtmux.Pane.capture_pane - TypeScript
pane.Pane.capture - Rust
pane.observe.Pane.capture - Java
io.github.libtmux.Pane.Pane.capture - .NET
LibTmux.Pane.CaptureAsync - C++
libtmux::Pane::capture - Swift
Server.capture(_:since:limit:)
- Python
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