ControlClient.output
Terminal output tmux pushes, as a cold Flow .
Source and package
- Module
- io.github.libtmux.kotlin
- Declared in
- ControlClient
- Package
- io.github.libtmux:libtmux-kotlin
- Source
- libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/ControlClient.kt
- public fun output(capacity: Int, onSubscribed: Kotlin suspending functions Allows a function to call suspending operations and pause without blocking a thread. It does not start a coroutine by itself. Language documentation () -> Unit = {}): Flow<Delivery<Pane
Output >> -
Description#
A fresh Java subscription opens per
kotlinx.coroutines.flow.Flow.collectand closes when collection ends, cancels, or throws — fan-out means collecting twice, each with its own gap accounting. Notsuspend: 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 beforecollect:control.output(32) { control.send("send-keys", ...) }.- Parameters
-
-
capacity ( Int )
-
onSubscribed ( Kotlin suspending functions Allows a function to call suspending operations and pause without blocking a thread. It does not start a coroutine by itself. Language documentation )
-
Discussed in Coroutines and flows , Getting started