Running.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.
Source and package
- Qualified name
-
tmux.Running. Stream To - Package
- tmux
- Declared in
Running- Distribution
- github.com/libtmux/libtmux-go/tmux
- Source
- tmux/session_run.go
- func (r *Running) StreamTo( ctx context
.Context , destination io.Writer , ) (RunResult , error) -
Description#
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.Linesis a screen capture rather than a notification stream and remains the authoritative record of what the command showed. Streaming needs a control client, which aConnection-bound value does not have, so it returnsErrConnectionRequiresProcessthere before waiting and leaves the command running; Wait alone does not.- Parameters
tmux command#
The tmux commands behind StreamTo.
list-windows -t session scope, cmd_list_windows_exec capture-pane delete-buffer refresh-client save-buffer tmux C API#
The C declarations in tmux that implement these commands.