On this page
io.github.libtmux.Server.Server.sessions
- Module
- io.github.libtmux.Server
- Declared in
- Server
- Package
- io.github.libtmux:libtmux
- Source
- libtmux/src/main/java/io/github/libtmux/Server.java
- Other languages
- PythonTypeScriptRustGo.NETC++Swift
-
Every session, captured now.
<p>Lenient, by the libtmux contract these accessors have always had: a tmux failure produces an empty list rather than raising, because "no sessions" is the ordinary answer and callers mostly cannot act on the difference. Those that can use
#snapshot(), which is strict.Discussed in Traversal
In other languages List the server’s sessions
- Python
libtmux.Server.sessions - TypeScript
server.Server.sessions - Rust
server.discovery.Server.sessions - Go
tmux.Server.Sessions - .NET
LibTmux.Server.Sessions - C++
libtmux::Server::sessions - Swift
Server.sessions()
- Python
Examples
// 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(); 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?; 0 declared, 0 inherited