# LibTmux.FSharp.Control.watchPane

- **Module:** LibTmux.FSharp
- **Package:** LibTmux.FSharp
- **Language:** F#
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux.FSharp/Control.fsi#L77
- **Page:** https://libtmux.org/en/fsharp/latest/reference/libtmux-fsharp-control-watchpane/

```
val watchPane: pane: LibTmux.Pane -> session: IControlModeSession -> IAsyncEnumerable<TmuxEvent>
```

Streams one pane's output from a borrowed control client.

The stream ends with <c>TmuxPaneGoneEvent</c> once the pane is confirmed
gone, or with <c>TmuxExitEvent</c> when the client ends.
<c>TmuxPanePausedEvent</c> and <c>TmuxPaneContinuedEvent</c> bracket output
a slow reader missed. It reads the client's single event stream, so other
events are consumed and dropped; follow several panes through one client
with <c>watchPanes</c>. Match what it yields with <c>PaneWatch</c>.

tmux discards output it has not yet sent once a pane's program exits,
so the last lines of a program that exits at once may never arrive.
Read final output with <c>Pane.run</c>, or capture a pane kept with
<c>remain-on-exit</c>.

## Parameters

- `pane` (`LibTmux.Pane`)
- `session` (`IControlModeSession`)

## Raises

- [`System.ArgumentException`](https://learn.microsoft.com/dotnet/api/system.argumentexception): The pane is not in the session the client is attached to; tmux sends a control client output only from that session.
- [`System.InvalidOperationException`](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception): The pane's window left the client's session while it was watched, so tmux sends none of its output any more.
