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

TestServer.daemon_state

Report whether the daemon is still running, and how it ended if not.

Source and package
Qualified name
libtmux::test::TestServer::daemon_state
Module
test
Declared in
TestServer
Package
libtmux
Source
crates/libtmux/src/test.rs
pub fn daemon_state(&mut self) -> DaemonState

Description#

Takes &mut self because reading the fate of a daemon that has exited reaps it; the guard then skips the signalling it no longer needs and still sweeps the panes the daemon left behind. Calling this on a running daemon changes nothing and costs one waitpid.

Examples#

use std::time::Duration;
use libtmux::{Command, test::{DaemonState, TestServer, retry_until}};
let mut guard = TestServer::new().await?;
guard.session("work").await?;
guard.server().cmd(Command::new("kill-server")).await.ok();
// tmux stops answering on the socket before the kernel has a status
// for the process behind it, so this is a wait rather than a reading.
retry_until(Duration::from_secs(5), async || {
!guard.daemon_state().is_running()
})
.await?;
assert!(matches!(guard.daemon_state(), DaemonState::Gone(_)));
guard.shutdown().await?;
Esc

Type to search.

Reference previewOpen reference