Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

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

View as Markdown

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
methodoverload2 overloads [source]
methodoverload2 overloads [source]
awaitText

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 name to it and block on Server#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-limit is 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

0 declared, 0 inherited

Esc

Type to search.