# io.github.libtmux.Pane.watchText

- **Module:** io.github.libtmux
- **Package:** io.github.libtmux:libtmux
- **Language:** Java
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-java/blob/5f88402151ff08fc0390dd438b90963692ec3fe4/libtmux/src/main/java/io/github/libtmux/Pane.java#L415
- **Page:** https://libtmux.org/en/java/latest/reference/io-github-libtmux-pane-pane-watchtext/

```
@Operation(Kind.WAIT)
public TextWait watchText(String text, Duration timeout)
        throws InterruptedException

@Operation(Kind.WAIT)
public TextWait watchText(
        String text,
        Duration timeout,
        Duration every)
        throws InterruptedException
```

As {@link #awaitText(String, Duration)}, and also returns what the pane showed.

The output is the pane at the wait's last successful read, so a pane that was killed, or a
server that went away, mid-wait still leaves the caller what had been printed. Ending as
{@link TextOutcome#PANE_GONE} or {@link TextOutcome#SERVER_GONE} is an answer, not an
exception, and neither is decided by a timer: the server answers a probe now or it does not,
and lists the pane now or does not, with or without another client attached to it.

## Parameters

- `text` (`String`)
- `timeout` (`Duration`)
- `every` (`Duration`): how long to leave between looks, at least 10 ms (for `watchText(text, timeout, every)`)

## Returns

the outcome and the output so far (for `watchText(text, timeout)`)

## Raises

- [`LibTmuxException`](/en/java/latest/reference/io-github-libtmux-exception-libtmuxexception-libtmuxexception/): if a read fails for a reason of the caller's while the server is still answering and still lists this pane (for `watchText(text, timeout)`)
- [`InterruptedException`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/InterruptedException.html): if the waiting thread is interrupted (for `watchText(text, timeout)`)
- [`IllegalArgumentException`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/IllegalArgumentException.html): if {@code every} is shorter than 10 ms (for `watchText(text, timeout, every)`)
