On this page
test.TestServer.daemon_state
- Module
- test
- Declared in
- TestServer
- Package
- libtmux
- Source
- crates/libtmux/src/test.rs
- daemon_state ( mut ) DaemonState
-
Report whether the daemon is still running, and how it ended if not.
Takes
&mut selfbecause 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 onewaitpid.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?;
0 declared, 0 inherited