Documentation
¶
Overview ¶
Example ¶
package main import ( "bytes" "fmt" "io" "strings" "github.com/docker-library/bashbrew/pkg/execpipe" ) func main() { pipe, err := execpipe.RunCommand("go", "version") if err != nil { panic(err) } defer pipe.Close() var buf bytes.Buffer io.Copy(&buf, pipe) fmt.Println(strings.SplitN(buf.String(), " version ", 2)[0]) }
Output: go
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pipe ¶
type Pipe struct {
// contains filtered or unexported fields
}
"io.ReadCloser" interface to a command's output where "Close()" is effectively "Wait()"
func Run ¶
start "cmd", capturing stdout in a pipe (be sure to call "Close" when finished reading to reap the process)
func RunCommand ¶
convenience wrapper for "Run"
Click to show internal directories.
Click to hide internal directories.