Server.generation
Which tmux daemon is answering on this endpoint.
Source and package
- Qualified name
-
libtmux::server:: Server:: generation - Module
- server
- Declared in
Server- Package
- libtmux
- Source
- crates/libtmux/src/server.rs
-
Description#
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%0taken before a restart addresses the replacement's%0afterwards, 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 this platform's
SystemTimeholds.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?;