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

tmux.Running.StreamTo

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

View as Markdown

Module
tmux
Declared in
Running
Package
github.com/libtmux/libtmux-go/tmux
Source
tmux/session_run.go
StreamTo ( ctx : context.Context , destination : io.Writer ) → (RunResult, error)
method [source]
method [source]
StreamTo

StreamTo copies what the command prints into destination as it prints it and then reports how it ended, so following a command and collecting its outcome are one blocking call rather than a goroutine the caller writes. It returns exactly what Running.Wait returns and, like Wait, removes the window unless RunOptions.Keep was set. destination is written only by this call, so it needs no synchronization of its own, and Running.Kill may be called from another goroutine while it runs.

The stream is what tmux pushed, which is not quite everything: output the command printed before StreamTo opened its observation may or may not be in it, and tmux can drop a line printed with nothing between it and the command's exit. RunResult.Lines is a screen capture rather than a notification stream and remains the authoritative record of what the command showed. Streaming needs a control client, which a Connection -bound value does not have, so it returns ErrConnectionRequiresProcess there; Wait alone does not.

0 declared, 0 inherited

Esc

Type to search.