Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

struct libtmux-go latest

PaneObservation

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.OpenObservation and close it when finished. Copies share notification reader ownership, terminal loss, and client lifetime; closing one closes them all.

Source and package
Qualified name
tmux.PaneObservation
Package
tmux
Distribution
github.com/libtmux/libtmux-go/tmux
Source
tmux/control_observation.go
struct tmux.PaneObservation

Members10#

Common operations2#

  • 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 ErrPaneObservationLost rather than io.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.
  • 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.

Other members8#

  • 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 ControlNotificationError affect only one call. Explicit close returns an error matching ErrControlClosed and os.ErrClosed.
  • Notifications method Notifications returns PaneObservation.NextNotification as 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.
  • 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.

Guides#

Pages that discuss PaneObservation.

Esc

Type to search.

Reference previewOpen reference