cmdstream

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2019 License: MIT Imports: 4 Imported by: 0

README

cmdstream

stream golang exec.Cmd outputs while it is running.

I sometimes need this, and I always copy-paste from other projects, so I figured why not leave it here as a lib.

Check godocs for usage examples.

Documentation

Overview

Package cmdstream provides utilities to stream long-running commands outputs to any io.Writer while they are still running, useful on CLIs that run other commands.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stream

func Stream(cmd *exec.Cmd, w io.Writer) error

Stream streams starts the given cmd and streams its output to the given io.Writer, waiting for the cmd to finish.

Example
var err = Stream(exec.Command("echo", "hello"), os.Stdout)
fmt.Println(" - err:", err)
Output:

hello - err: <nil>

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL