tmux.PaneObservation
Go
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust Unavailable
- Go
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- tmux
- Package
- github.com/libtmux/libtmux-go/tmux
- Source
- tmux/control_observation.go
-
PaneObservation is one visible pane baseline followed by the exact control notification stream after that baseline. That stream is the observation's whole control connection, so a caller wanting only this pane's output selects it by identifier. Create one with
Pane.OpenObservationand close it when finished. Copies share notification reader ownership, terminal loss, and client lifetime; closing one closes them all.Discussed in Context managers
10 declared, 0 inherited
Members
- Baseline method Baseline returns an owned copy of the pane's visible text at the observation boundary.
- ClientName method ClientName returns the observation's own control client identity - the name a listing of attached clients must exclude, the same way it already excludes a caller's long-lived command connection, so a caller's own stream never reads as another person watching.
- Close method Close stops the dedicated control client. It is safe to call more than once.
- CloseContext method CloseContext starts idempotent observation shutdown and waits within ctx.
- NextNotification method NextNotification returns the next notification strictly after the pane baseline, from the whole connection rather than this pane alone. Notifications queued before that boundary are discarded. Concurrent calls are serialized. Caller context errors and
ControlNotificationErroraffect only one call. Explicit close returns an error matchingos.ErrClosed. - Notifications method Notifications returns
PaneObservation.NextNotificationas a range loop; exactly one iterator or direct read may run at a time. Malformed notifications yield their error and iteration continues; every other error ends the loop after being yielded. - PaneID method PaneID returns the pane selected at the observation boundary.
- Reader method Reader returns the pane's output after the baseline as a byte stream: what the program in the pane writes to its terminal, in order, and nothing from any other pane on the connection. Reads block until the pane writes, ctx ends, or the observation closes. A lost observation ends the stream with
ErrPaneObservationLostrather thanio.EOF. The bytes are the terminal's: escape sequences and carriage returns arrive as written, and the echo of what is typed into the pane arrives before the reply, as it does on screen. Exactly one reader or direct notification read may run at a time. - SessionID method SessionID returns the session the observation's own control client attached to, resolved live when the observation opened - the session a listing must count this client's attachment against, not merely the pane's session at some other, possibly stale, snapshot.
- WaitFor method WaitFor reads what the pane writes after the observation's baseline and calls match with all of it each time the pane writes, until match reports true, ctx ends, or the observation is lost. It returns the text match accepted, or what was read before the error. tmux pushes each write as it happens, so nothing is polled.