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
-
Description#
crate::Client::is_own()is the usual form, and reads better: ask a handle fromSelf::clients()rather than doing pid arithmetic. This one is for a caller that already has a pid and no handle -- readinglist-clientsitself 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 everycrate::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?;