Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

pane.Pane.stream_output

Rust
  • Python Unavailable
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

View as Markdown

Module
pane
Declared in
Pane
Package
libtmux
Source
crates/libtmux/src/pane/observe.rs
stream_output ( self ) → Result<crate::control::PaneOutput, Error>
method [source]
method [source]
stream_output

Watch what this pane writes, as it writes it.

Pane::capture reads what is on screen now; this reports every byte the pane produces from here on, including what scrolls away. It opens a control-mode connection to the session holding the pane and keeps it, so there is no polling and no sampling interval to get wrong. Where the pane lives is resolved here rather than taken from this handle.

The bytes are the pane's own, terminal escapes included. tmux reports them in whatever sized chunks it has, so a caller wanting lines has to buffer.

Keep reading, or the pane stops. Events are handed over with backpressure rather than dropped, so a stream left unread stops the connection reading from tmux, and tmux stops the pane that is filling it. A caller who wants to stop watching calls PaneOutput::shutdown rather than leaving the handle idle.

tmux discards what a pane has buffered when the pane exits, so a command that writes and returns immediately may be reported as nothing at all.

Errors

Returns Error::ObjectGone when the pane no longer exists, a listing error when tmux could not be read, or an error when the control-mode connection cannot be opened.

Cancel safety

Nothing is left held: a dropped call closes the connection it opened, and the mutes it set end with that connection.

Examples

let mut output = pane.stream_output().await?;
while let Some(chunk) = output.next_chunk().await {
println!("{} bytes", chunk.len());
}
output.shutdown().await

0 declared, 0 inherited

Esc

Type to search.