On this page
tmux.ControlClient
- Module
- tmux
- Package
- github.com/libtmux/libtmux-go/tmux
- Source
- tmux/control_client.go
-
ControlClient is one attached tmux control-mode process. Create one with
Server.OpenControl. Concurrent Cmd, Wait, and close calls are supported; exactly one caller may execute NextNotification at a time.
11 declared, 0 inherited
Members
- 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. Exactly one caller may execute it at a time. Natural process exit preserves queued notifications until they drain through io.EOF; Close releases the queue and makes subsequent reads report os.ErrClosed. A terminal reader error follows notifications queued before that failure. A full bounded queue likewise drains before reporting
ControlNotificationOverflowError. - 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.