libtmux Reference MCP Search
On this page

server.discovery.Server.sessions

View as Markdown

Module
server.discovery
Declared in
Server
Package
libtmux
Source
crates/libtmux/src/server/discovery.rs
Other languages
PythonTypeScriptGoJava.NETC++Swift
sessions ( self ) Result<Vec<Session>, Error>
method [source]
method [source]
sessions

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

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

Esc

Type to search.