Pane.wait_until
Wait until settled holds for this pane's captured lines.
Source and package
- Qualified name
-
libtmux::pane:: Pane:: wait _until - Module
- pane
- Declared in
Pane- Package
- libtmux
- Source
- crates/libtmux/src/pane/observe.rs
-
Description#
For what a literal
Pane::wait_for_text()cannot say: a line equal to something rather than containing it, a count, a pattern, the shape of the last line.settledsees whatPane::capture_with()returns forCaptureOptions::history().join_wrapped(): scrollback and screen, one entry per line, a line tmux wrapped joined back into one, and the screen's unused rows as empty lines at the end.Looks are the ones
Pane::wait_for_text()describes: 120ms apart, the first before any sleep, so lines already there answer at once. A pane whose process ends answersPaneWait::Deadrather than running to the deadline. It polls even on a handle routed throughServer::over_control_mode(), because that connection's%outputbelongs to whoever reads its events, so waking on it would attach a second client per wait to save under three milliseconds on a marker (benches/waits.rs).A
query::Matcherover one line fits as|lines| lines.iter().any(|line| matcher.matches(line)).Errors
Returns an error when tmux cannot be reached or refuses a look, which includes a pane that has been closed. Running out of time is
PaneWait::TimedOut, not an error.Cancel safety
Nothing happened. A look only reads, so a future dropped mid-look leaves tmux as it was, and output produced in the meantime stays in the scrollback, up to
history-limit, for the next wait to find.Examples#
use libtmux::PaneWait;use std::time::Duration;// The leading `echo` starts the output on a row of its own: keys sent// before the shell's first prompt would otherwise print `$ tick`.pane.send_line("echo; for n in 1 2 3; do echo tick; done").await?;// The echoed command contains `tick`; only the output is a line equal to it.let ticked = pane.wait_until(Duration::from_secs(10), |lines| {lines.iter().filter(|line| **line == "tick").count() == 3}).await?;assert_eq!(ticked, PaneWait::Arrived);
tmux command#
The tmux commands behind wait_until.
tmux C API#
The C declarations in tmux that implement these commands.