From 9cdc575666faad4c162f4b4cf519bfdd1fd528dc Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 24 Jul 2026 17:56:36 +0200 Subject: feat: Finalize design for fish-shell integration --- crates/daemon/src/daemon.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'crates/daemon/src/daemon.rs') diff --git a/crates/daemon/src/daemon.rs b/crates/daemon/src/daemon.rs index 1c3afcde..70e65c1e 100644 --- a/crates/daemon/src/daemon.rs +++ b/crates/daemon/src/daemon.rs @@ -87,6 +87,20 @@ impl DaemonHandle { tracing::warn!("failed to emit event (no receivers?): {e}"); } } + pub(crate) async fn wait_for(&self, matches: fn(&DaemonEvent) -> bool) -> Result { + let mut rx = self.subscribe(); + loop { + match rx.recv().await { + Ok(e) if matches(&e) => { + return Ok(e); + } + Err(err) => { + return Err(err).context("while waiting for events"); + } + Ok(_) => (), + } + } + } /// Subscribe to the event bus. /// -- cgit v1.3.1