runcmd

package module
v0.0.0-...-2a9d85f Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2015 License: BSD-3-Clause Imports: 4 Imported by: 4

README

Documentation

Overview

Package runcmd provides a convenience Run function for exec.Cmd which includes the original command along with the output and error streams.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandError

type CommandError struct {
	// contains filtered or unexported fields
}

CommandError is returned by run and provides an error string which includes the full command and the contents of the output and error streams.

func (*CommandError) Error

func (e *CommandError) Error() string

Error provides a helpful error text.

type Streams

type Streams struct {
	// contains filtered or unexported fields
}

Streams provides access to the output and error buffers.

func Run

func Run(cmd *exec.Cmd) (*Streams, error)

Run the command and return the associated streams, and error if any. The error may be a CommandError.

func (*Streams) Stderr

func (s *Streams) Stderr() *bytes.Buffer

Stderr returns the underlying buffer with the contents of the error stream.

func (*Streams) Stdout

func (s *Streams) Stdout() *bytes.Buffer

Stdout returns the underlying buffer with the contents of the output stream.

Jump to

Keyboard shortcuts

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