Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-go latest

PaneObservation.WaitFor

WaitFor reads what the pane writes after the observation's baseline and calls match with all of it each time the pane writes, until match reports true, ctx ends, or the observation is lost. It returns the text match accepted, or what was read before the error. tmux pushes each write as it happens, so nothing is polled.

Source and package
Qualified name
tmux.PaneObservation.WaitFor
Package
tmux
Declared in
PaneObservation
Distribution
github.com/libtmux/libtmux-go/tmux
Source
tmux/pane_wait.go
func (o *PaneObservation) WaitFor( ctx context.Context, match func(text string) bool, ) (PaneText, error)

Description#

The baseline is not part of the text: check PaneObservation.Baseline for what was on screen already. A shell echoes what is typed into it, and the echo is output like any other, so open the observation before typing and match on what the command prints rather than on the command itself.

Writes that arrived together reach match once. Exactly one read may run at a time, as for PaneObservation.NextNotification, and a malformed notification is skipped as PaneObservation.Reader skips it.

Parameters

Guides#

Pages that discuss WaitFor.

Esc

Type to search.

Reference previewOpen reference