target.ServerGeneration
Rust
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust
- Go Unavailable
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- target
- Package
- libtmux
- Source
- crates/libtmux/src/target.rs
-
Which tmux daemon is answering on an endpoint.
ServerIdentityanswers "where", and that is not enough to answer "which": tmux reuses the socket file across restarts, so a replacement daemon is indistinguishable from the one it replaced by path alone. It also reissues ids from the start, so the replacement's first pane is%0too.Holding a handle across a possible restart is therefore a correctness question rather than a liveness one. A stale read fails harmlessly; a stale *mutation* lands on whatever now wears that id.
The pid alone would not do. A replacement daemon can be handed the pid of the one it replaced, so the start time is what makes this a generation rather than a guess.
Examples
let guard = libtmux::test::TestServer::new().await?;let server = guard.server();// Capture the generation beside whatever ids are being held.let generation = server.generation().await?;let session = server.new_session("work").await?;// Before acting on those ids later, confirm the daemon has not been// replaced underneath them.assert_eq!(server.generation().await?, generation);let _ = session;guard.shutdown().await?;
2 declared, 0 inherited
Members
- pid method The tmux server process id.
- start_time method When that server started, to the whole second tmux keeps.