ControlClient
ControlClient is one attached tmux control-mode process. Create one with Server.OpenControl. Concurrent Cmd, Wait, close, and NextNotification calls are supported; concurrent notification reads are serialized.
Source and package
- Qualified name
-
tmux.Control Client - Package
- tmux
- Distribution
- github.com/libtmux/libtmux-go/tmux
- Source
- tmux/control_client.go
-
Description#
It is the low-level handle: it carries commands and notifications on one client and can
ControlClient.Reconnect, but records do not run through it.Session.OpenControlreturns aConnectioninstead, whose lanes the sessions, windows and panes obtained from it use for their own commands.
Members11#
- Call method Call executes one safely encoded tmux command and returns all its reply frames. Cancellation after writing returns
ErrOutcomeUnknownwith the context error while the client drains through the boundary before reuse. A transport failure returns any frames proven before the failure together withErrOutcomeUnknown. - ClientName method ClientName returns the tmux-assigned identity captured during registration.
- Close method Close stops the control process and releases its notification queue. It is safe to call concurrently and more than once.
- CloseContext method CloseContext starts idempotent control-client shutdown and waits within ctx. The context bounds only the wait: an already-ended context still starts shutdown, and a later call may resume waiting for the same close.
- Cmd method Cmd executes one safely encoded tmux command through the control client. It requires exactly one reply frame and returns
ErrControlReplyCountotherwise. UseControlClient.Callfor aliases that may produce zero or multiple frames. - NextNotification method NextNotification returns the next ordered control-mode notification. Concurrent calls are serialized, as for
PaneObservation.NextNotification: each notification goes to exactly one call, in order, and a call waiting its turn returns when ctx ends. - Notifications method Notifications returns an iterator over what tmux says without being asked: pane output, and the events behind
ControlNotification. - Reconnect method Reconnect registers a replacement on the last attached session observed at a reply boundary, then closes the receiver. Failed replacement setup does not initiate receiver shutdown. If shutdown fails, Reconnect returns the live replacement with that error; the caller owns every non-nil result. A receiver whose stream ended cleanly can recover from its last observation. Commands are never replayed.
- Server method Server returns the server handle used to start the control client.
- Session method Session returns the materialized session selected during startup.
- Wait method Wait blocks until the control process exits or ctx ends. It does not close the notification queue; callers may drain final notifications before Close.
Guides#
Pages that discuss ControlClient.