libtmux Reference MCP Search
On this page

server.Server.generation

View as Markdown

Module
server
Declared in
Server
Package
libtmux
Source
crates/libtmux/src/server.rs
generation ( self ) Result<ServerGeneration, Error>
method [source]
method [source]
generation

Which tmux daemon is answering on this endpoint.

A socket path does not identify a daemon. tmux reuses the socket file across restarts -- it survives kill-server, and a replacement daemon binds the same inode -- so an endpoint that looks unchanged can be a different server holding different objects under the same ids. A pane handle for %0 taken before a restart addresses the *replacement's* %0 afterwards, which for a mutation is the wrong object rather than a missing one.

Capture this before work that must not be misapplied, and check it with Self::require_generation before acting on a handle that has been held across time.

Errors

Returns an error when tmux cannot be reached, or answers with something that is not a pid and a start time.

Examples

let guard = libtmux::test::TestServer::new().await?;
let server = guard.server();
server.new_session("work").await?;

let generation = server.generation().await?;
// Unchanged while the daemon is the same one.
server.require_generation(generation).await?;

guard.shutdown().await?;

0 declared, 0 inherited

Esc

Type to search.