tmux.ControlClient
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_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.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.Discussed in Context managers
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. Close releases the queue and makes subsequent reads report os.ErrClosed, drained through queued notifications first. Natural process exit before a caller asked to close instead reports
ErrControlStreamLost- most often because the server the underlying tmux client was attached to exited - naming the tmux exit reason when one was sent. A terminal reader error follows notifications queued before that failure. A full bounded queue likewise drains before reportingControlNotificationOverflowError. - 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.