# io.github.libtmux.kotlin.ControlClient.output

- **Module:** io.github.libtmux.kotlin
- **Package:** io.github.libtmux:libtmux-kotlin
- **Language:** Kotlin
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-java/blob/f56392b5d9bc7f1f9c1631842333fb90f3d82d40/libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/ControlClient.kt#L45
- **Page:** https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-controlclient-output/

```
public fun output(capacity: Int, onSubscribed: suspend () -> Unit = {}): Flow<Delivery<PaneOutput>>
```

Terminal output tmux pushes, as a cold [Flow].

A fresh Java subscription opens per [kotlinx.coroutines.flow.Flow.collect] and closes when
collection ends, cancels, or throws — fan-out means collecting twice, each with its own gap
accounting. Not `suspend`: opening the subscription is local and does no tmux round trip: only
collecting it reads.

Output tmux sends before the subscription opens is not delivered, and a cold flow opens it
only when collection starts. So a command whose output is wanted belongs in [onSubscribed],
which runs once the subscription exists and before the first read, rather than before
`collect`: `control.output(32) { control.send("send-keys", ...) }`.

## Parameters

- `capacity` (`Int`)
- `onSubscribed` (`suspend`)
