Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-rs latest

Server.owns_control_client

Report whether this process itself opened the control client with this pid, and it is still running.

Source and package
Qualified name
libtmux::server::Server::owns_control_client
Module
server
Declared in
Server
Package
libtmux
Source
crates/libtmux/src/server.rs
#[cfg(feature = "control-mode")] #[must_use] pub fn owns_control_client(&self, pid: u32) -> bool

Description#

crate::Client::is_own() is the usual form, and reads better: ask a handle from Self::clients() rather than doing pid arithmetic. This one is for a caller that already has a pid and no handle -- reading list-clients itself to get sessions and pids in one command, which a per-client lookup would turn into one command each.

crate::Pane::stream_output(), crate::Client::pid() and friends can all open or report a control-mode connection; tmux counts any of them as an attached client the same as a human's terminal. A caller telling its own observation apart from an attached human reads every crate::Client::pid() it cares about through this rather than tracking one connection it happened to keep, because more than one may be open at once.

Examples#

let guard = libtmux::test::TestServer::new().await?;
let server = guard.server();
// Nothing has opened a control client yet.
assert!(!server.owns_control_client(std::process::id()));
guard.shutdown().await?;
Parameters
Esc

Type to search.

Reference previewOpen reference