wait_for_text
Source and package
- Qualified name
-
LibTmux .wait _for _text - Module
- LibTmux
- Package
- LibTmux
- Source
- src/waits.jl
- wait_for_text( stream::Lib
Tmux , text::Abstract.Observation Stream String ; max_bytes , kwargs..., )wait_for_text( screen::LibTmux , text::Abstract.Screen Watch String ; baseline, max_bytes , )wait_for_text( server::LibTmux , pane::Lib.Server Tmux , text::Abstract.Pane Ref String ; baseline, interval, timeout, cancel, max_bytes , ) -
Methods#
wait_for_text( stream::Lib
Tmux , text::Abstract.Observation Stream String ; max_bytes , kwargs..., )[source]#Wait for a nonempty literal UTF-8 string using
wait_for's raw-output, baseline, bounded-tail and total-deadline policy. The pattern must fit the tail limit. Matching can include terminal echo or concurrent writers; it is literal-text evidence, not process success.wait_for_text(stream::ObservationStream, text; kwargs...)To wait for text on the visible screen instead, on any supported tmux release and without a control stream, use
wait_for_text(server, pane, text).Every decoded byte is searched before tail retention. A match in the middle of a large chunk remains visible: returned text ends at that match, and later bytes in the same event count as received but omitted from the result.
wait_for_text( screen::Lib
Tmux , text::Abstract.Screen Watch String ; baseline, max_bytes , )[source]#wait_for_text( server::Lib
Tmux , pane::Lib.Server Tmux , text::Abstract.Pane Ref String ; baseline, interval, timeout, cancel, max_bytes , )[source]#Wait until the literal
textis on the pane's visible screen. This method pollscapture-paneon every supported tmux release and opens no control client; theObservationStreammethod instead reads raw output and needs tmux 3.7. Every read starts its own tmux client process, so an open control connection to the same server never carries a read. The server form iswatch_screenplus one wait.wait_for_text(server::Server, pane::PaneRef, text; baseline=false,interval=0.1, timeout=5.0, cancel=nothing, max_bytes=65536)-> ScreenWaitResultwait_for_text(screen::ScreenWatch, text; baseline=false, max_bytes=65536)-> ScreenWaitResulttextmust be nonempty valid UTF-8 that fits withinmax_bytes, otherwiseArgumentErroris raised before any tmux command runs.max_bytesbounds only the tail of the screen kept in the result; when it cuts the screen, the match can lie in the dropped head.By default only text that appears after the entry read counts: the entry read sets a bar equal to the number of occurrences on the screen, and a later read matches when its count exceeds the bar. The bar is never lowered, so text that scrolls off or is repainted cannot invent a match. With
baseline=truetext already on the entry screen matches at once, withsource == :baselineandmatched_at_entry == true.Each read is one tmux invocation:
capture-pane -p -Jand a hook-freerun-shell -Cmarker that reports the pane id, whether the pane is dead, whether it shows the alternate screen and which server generation answered.-Jjoins wrapped rows. The first read comes before the first sleep, so atimeoutshorter thanintervalstill reads once. The matcher sees the capture before the marker is acted on, so a screen read from a pane that has just died (remain-on-exit) still matches. Apanethat belongs to another server or to an earlier generation of this one raisesCrossServerReferenceorStaleReferenceinstead of reading another pane.A pane that is dead (
remain-on-exit), a pane tmux no longer knows, or a server that is gone raisesScreenWaitEndedwith the last screen read. Messages are matched in English, as elsewhere in the package. CancellingcancelraisesRequestCancelledand an expiredtimeoutraisesDeadlineExceeded; neither carries text, and a match found after either is never reported.Limits
- Only the visible screen is read. Text that scrolled off is not seen.
- A repaint shows only its final state; the control stream shows every state.
- While a full-screen program uses the alternate screen, the capture shows only that screen. Such a read is not compared: it neither lowers nor raises the bar, so a round trip through
lessorvimdoes not invent a match. If the entry read is on the alternate screen, the first read back on the normal screen sets the bar. - If an old occurrence scrolls off and a new one arrives between two reads, the count does not rise and the wait misses it.
- Typed echo that contains
textcounts as an occurrence. Match on what the command prints, not on the command. - Every read runs the owner's
after-capture-panehook, and a hook that prints adds its output to the captured text.
- Parameters
-
-
stream(LibTmux ) # for.Observation Stream wait_for_text(stream, text, max_bytes, kwargs) -
max_bytes=65536# forwait_for_text(stream, text, max_bytes, kwargs) -
screen(LibTmux ) # for.Screen Watch wait_for_text(screen, text, baseline, max_bytes) -
baseline=false(Bool) # forwait_for_text(screen, text, baseline, max_bytes);wait_for_text(server, pane, text, baseline, interval, timeout, cancel, max_bytes) -
max_bytes=65536(Integer) # forwait_for_text(screen, text, baseline, max_bytes);wait_for_text(server, pane, text, baseline, interval, timeout, cancel, max_bytes) -
server(LibTmux ) # for.Server wait_for_text(server, pane, text, baseline, interval, timeout, cancel, max_bytes) -
pane(LibTmux ) # for.Pane Ref wait_for_text(server, pane, text, baseline, interval, timeout, cancel, max_bytes) -
interval=0.1(Real) # forwait_for_text(server, pane, text, baseline, interval, timeout, cancel, max_bytes) -
timeout=5.0(Real) # forwait_for_text(server, pane, text, baseline, interval, timeout, cancel, max_bytes) -
cancel=nothing# forwait_for_text(server, pane, text, baseline, interval, timeout, cancel, max_bytes)
-
Guides#
Pages that discuss wait_for_text.