pane.Pane.wait_until
Rust
- Python Unavailable
- TypeScript Unavailable
- Rust
- Go Unavailable
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- pane
- Declared in
- Pane
- Package
- libtmux
- Source
- crates/libtmux/src/pane/observe.rs
-
Wait until
settledholds for this pane's captured lines.For what a literal
Pane::wait_for_textcannot say: a line equal to something rather than containing it, a count, a pattern, the shape of the last line.settledsees whatPane::capture_withreturns 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_textdescribes: 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;pane.send_line("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);
0 declared, 0 inherited