io.github.libtmux.Pane.Pane.awaitText
Java
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust Unavailable
- Go Unavailable
- Java
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- io.github.libtmux.Pane
- Declared in
- Pane
- Package
- io.github.libtmux:libtmux
- Source
- libtmux/src/main/java/io/github/libtmux/Pane.java
- awaitText ( text : String , timeout : Duration ) TextOutcome ( text : String , timeout : Duration , every : Duration ) TextOutcome
-
Waits until this pane's text contains something, and says why the wait ended.
Reach for this last. It reads the screen on a timer, which is a heuristic about a program's output rather than a fact about it, and the cheaper waits are exact:
- If you wrote the command, append
; tmux wait-for -S nameto it and block onServer#channel. tmux blocks server-side and returns on the signal itself, so nothing is inferred from the screen and one tmux process covers the whole wait. That is the only deterministic wait here, and it is the right one whenever the command is yours. - If you did not write the command — a daemon printing that it is ready, a build somebody else started — this is the case polling is for.
The timeout bounds the whole wait, reads included. Each read is given only what is left of it, so a slow tmux cannot stretch a short wait out to the server's default deadline, and text that first appears after the deadline is not reported. The first read alone is allowed at least a quarter of a second, so a timeout shorter than one read can still answer
TextOutcome#PRESENT_AT_ENTRY.Waiting longer is also less reliable, not more: tmux frees the oldest scrollback once
history-limitis reached, so a long wait on a productive pane can end up reading past the lines it was watching for.- Parameters
-
-
every ( Duration ) – how long to leave between looks, at least 10 ms
-
- Raises
-
-
IllegalArgumentException – if
everyis shorter than 10 ms
-
- If you wrote the command, append
0 declared, 0 inherited