# LibTmux\Wait-TmuxPaneText

- **Package:** LibTmux
- **Language:** PowerShell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/src/LibTmux.PowerShell/WaitTmuxPaneTextCommand.cs#L7
- **Page:** https://libtmux.org/en/powershell/latest/reference/libtmux-wait-tmuxpanetext/

```
Wait-TmuxPaneText
    [-Pane] <LibTmux.Pane>
    [[-Pattern] <System.String[]>]
    [-StopPattern <System.String[]>]
    [-CaseSensitive]
    [-SimpleMatch]
    [-Timeout <System.Double>]
    [-AllowPollingFallback]
    [-TailLines <System.Int32>]
    [-MaxOutputBytes <System.Int32>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
```

[`Wait`](/en/csharp/latest/reference/libtmux-tmuxwaitmode-wait/) for rendered text in a native tmux pane.

Watch the selected pane until one pattern matches rendered text. A match
already visible when observation begins returns [`PresentAtEntry`](/en/csharp/latest/reference/libtmux-panewaitoutcome-presentatentry/). With no
pattern, the command waits for any new rendered output and returns [`AnyOutput`](/en/csharp/latest/reference/libtmux-panewaitoutcome-anyoutput/).
Stop patterns return [`Stopped`](/en/csharp/latest/reference/libtmux-panewaitoutcome-stopped/); the deadline and a pane exit return `TimedOut`
and `PaneExited`. These are native [`LibTmux.PaneWaitResult`](/en/csharp/latest/reference/libtmux-panewaitresult/) outcomes, not cmdlet
errors. Inspect [`Outcome`](/en/csharp/latest/reference/libtmux-panewaitresult-outcome/) before treating a wait as readiness.

The observer attaches a temporary control client before its first capture.
Control events wake a grid-aware reader; matching uses captured rendered rows,
not individual output fragments. Results include a bounded final screen tail,
elapsed and effective timeout, dropped-event count, polling fallback, and
missed-line or lost-anchor indicators. The default view shows `Missed` and
omits the tail; inspect [`Tail`](/en/csharp/latest/reference/libtmux-panewaitresult-tail/) explicitly if you need its text. A lost event
or anchor means the observer may have missed transient output.

Control observation is required by default. [`-AllowPollingFallback`](/en/powershell/latest/reference/libtmux-wait-tmuxpanetext/#LibTmux%5CWait-TmuxPaneText.parameter.AllowPollingFallback) permits
bounded polling if control observation fails, and the result discloses whether
it ran. The wait borrows the pane and server; it disposes only its own observer
and client on completion or Ctrl+C. [`-WhatIf`](/en/powershell/latest/reference/libtmux-wait-tmuxpanetext/#LibTmux%5CWait-TmuxPaneText.parameter.WhatIf) attaches no client and captures
no text. Confirmation identifies the endpoint and pane without displaying
patterns or pane content.

This command recognizes text; it does not authenticate command completion or
an exit status. Use [Invoke-TmuxPaneCommand](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Invoke-TmuxPaneCommand.md) for a
shell command you start or [Wait-TmuxChannel](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Wait-TmuxChannel.md) for a
cooperative application signal. Visible text can include input echoed by a
shell or application. `Get-TmuxPaneContent -History` reads retained rendered
scrollback, while `-Raw` joins rendered rows; neither is a byte-exact process
stream.

### Notes

[`Tmux.PaneTextWaitFailed`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Wait-TmuxPaneText.md#notes) retains the native pane as its error target for
transport and capture failures. [`Tmux.InvalidTimeout`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Wait-TmuxPaneText.md#notes) and
[`Tmux.InvalidPaneTextRequest`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Wait-TmuxPaneText.md#notes) fail before attaching a client. `-ErrorAction
Continue` can advance to the next pane after an operation error;
`-ErrorAction Stop` stops the pipeline.

## Command details

- **Command type:** [`cmdlet`](/en/powershell/latest/reference/glossary/#cmdlet)
- **Confirmation:** Supports `-WhatIf` and `-Confirm`; confirm impact: Medium.
- **Positional binding:** Enabled.
- **Pipeline inputs:** `LibTmux.Pane`: The pane selected from an explicit endpoint.
- **Outputs:** `LibTmux.PaneWaitResult`

Related APIs:

- [Send input to a pane](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/input.md)
- [Capture rendered pane text](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/capture.md)

## Examples

Example 1

Given a native `$pane` running a program that reads one line, prints `READY`,
then stays alive, send a trigger that cannot match the ready pattern. Output
may arrive before the wait begins; both `PresentAtEntry` and `Matched` mean the
line was observed:

[Source example](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Wait-TmuxPaneText.md).

```powershell
& {
    $pane | LibTmux\Send-TmuxText -Text go -Enter -Confirm:$false
    $pane |
        LibTmux\Wait-TmuxPaneText -Pattern '^READY$' -Timeout 5 -Confirm:$false
}
```

## Parameters

- `Pane` (`LibTmux.Pane`): The native pane to observe. An arbitrary object with an Id property is not a
pane owner.
  Required. Position 0. Accepts pipeline input by value. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?view=powershellsdk-7.4.0).
- `Pattern` (`System.String[]`): Regular expressions to wait for. Omit or pass an empty array to wait for any
new rendered output. Empty entries are rejected. The shared observer bounds
regex matching work and time over rendered rows. It uses .NET's nonbacktracking
regex mode; unsupported constructs such as lookarounds and backreferences are
rejected before attaching a client.
  Optional. Position 1. Does not accept pipeline input.
- `StopPattern` (`System.String[]`): Regular expressions that end the wait with `Outcome = Stopped`. Stop patterns
take precedence over wanted patterns, including text visible at entry. Across both
pattern lists, at most 32 entries, 999 UTF-8 bytes per entry and 16384 bytes
in total are accepted.
  Optional. Named parameter. Does not accept pipeline input.
- `CaseSensitive` (`System.Management.Automation.SwitchParameter`): Match letter case. Patterns are case-insensitive by default.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input.
- `SimpleMatch` (`System.Management.Automation.SwitchParameter`): Treat each pattern and stop pattern as literal text instead of a regular
expression. `-CaseSensitive` still controls case matching.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input.
- `Timeout` (`System.Double`): Wait budget in seconds. Fractions are accepted. The default is 10; the valid
range is 0.0000001 through 86400. A timed-out wait does not prove the program
stopped or the desired text was never printed.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `10`.
- `AllowPollingFallback` (`System.Management.Automation.SwitchParameter`): Allow bounded capture polling if the control client cannot observe the pane.
The default is to report the control failure. `PollingFallback` discloses use.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input.
- `TailLines` (`System.Int32`): Maximum rendered screen lines retained in the result tail. The default is 20;
the valid range is 1 through 1000. Truncation is reported separately.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `20`. [`ValidateRange(1, 1000)`](https://learn.microsoft.com/dotnet/api/system.management.automation.validaterangeattribute?view=powershellsdk-7.4.0).
- `MaxOutputBytes` (`System.Int32`): Maximum UTF-8 bytes retained in the result tail. The default is 65536; the
valid range is 1 through 1048576. This bounds returned text, not the producer.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `65536`. [`ValidateRange(1, 1048576)`](https://learn.microsoft.com/dotnet/api/system.management.automation.validaterangeattribute?view=powershellsdk-7.4.0).
- `Verbose` (`System.Management.Automation.SwitchParameter`): Display verbose messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `vb`.
- `Debug` (`System.Management.Automation.SwitchParameter`): Display debug messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `db`.
- `ErrorAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to non-terminating errors.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ea`.
- `WarningAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to warning messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wa`.
- `InformationAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles information messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `infa`.
- `ProgressAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles progress updates.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `proga`.
- `ErrorVariable` (`System.String`): Store the command's error records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ev`.
- `WarningVariable` (`System.String`): Store the command's warning records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wv`.
- `InformationVariable` (`System.String`): Store the command's information records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `iv`.
- `OutVariable` (`System.String`): Save output in the named variable while passing it down the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ov`.
- `OutBuffer` (`System.Int32`): Buffer output before passing it to the next pipeline command.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ob`.
- `PipelineVariable` (`System.String`): Make the most recent output object available through a named variable within the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `pv`.
- `WhatIf` (`System.Management.Automation.SwitchParameter`): Describe the intended observer without attaching a client or capturing text.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Aliases: `wi`.
- `Confirm` (`System.Management.Automation.SwitchParameter`): Prompt before attaching an observer. The prompt omits pattern and pane text.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Aliases: `cf`.

## Returns

`LibTmux.PaneWaitResult`: One result per pane with outcome, matched pattern, bounded rendered tail and
observation metadata. No result is emitted for `-WhatIf` or an empty pipeline.
