On this page
server.discovery.Server.sessions
- Module
- server.discovery
- Declared in
- Server
- Package
- libtmux
- Source
- crates/libtmux/src/server/discovery.rs
- Other languages
- PythonTypeScriptGoJava.NETC++Swift
-
List every session on the server, preserving any failure.
Errors
Returns an error when the list command cannot run, or when its output cannot be decoded into snapshots.
Examples
let guard = libtmux::test::TestServer::new().await?; guard.session("work").await?; let sessions = guard.server().sessions().await?; assert_eq!(sessions.len(), 1); assert!(sessions[0].id().to_string().starts_with('$')); guard.shutdown().await?;Discussed in Traversal
In other languages List the server’s sessions
- Python
libtmux.Server.sessions - TypeScript
server.Server.sessions - Go
tmux.Server.Sessions - Java
io.github.libtmux.Server.Server.sessions - .NET
LibTmux.Server.Sessions - C++
libtmux::Server::sessions - Swift
Server.sessions()
- Python
Examples
let guard = libtmux::test::TestServer::new().await?;
guard.session("work").await?;
let sessions = guard.server().sessions().await?;
assert_eq!(sessions.len(), 1);
assert!(sessions[0].id().to_string().starts_with('$'));
guard.shutdown().await?; // One invocation, and every collection agrees with the others.
const now = await server.snapshot();
for (const session of now.sessions) console.log(session.name, session.windows.length); const sessions = await server.sessions();
sessions.where({ name: "work" }).count(); 0 declared, 0 inherited