Version: v0.0.0-...-854ad97 Latest Latest

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

Go to latest
Published: Oct 26, 2021 License: BSD-3-Clause Imports: 3 Imported by: 0



Package shell augments the standard library os/exec Cmd struct and functions with convenience functions for reading piped output.



This section is empty.


This section is empty.


This section is empty.


type Cmd

type Cmd struct {
	OutReader *bufio.Reader
	ErrReader *bufio.Reader
	Err       error

Cmd extends the exec.Cmd struct with convenience functions for reading piped output.

func Command

func Command(name string, args ...string) Cmd

Command returns the GinCmd struct to execute the named program with the given arguments.

func (*Cmd) Output

func (cmd *Cmd) Output() ([]byte, error)

Output runs the command and returns its standard output.

func (*Cmd) OutputError

func (cmd *Cmd) OutputError() ([]byte, []byte, error)

OutputError runs the command and returns the standard output and standard error as two byte slices.

type Error

type Error struct {
	// The error that was returned by the underlying system or API call
	UError string
	// The function where the error originated
	Origin string
	// Human-readable description of error and conditions
	Description string

Error is used to return errors caused by web requests, API calls, or system calls. It implements the error built-in interface. The Error() method returns the Description unless it is not set, in which case it returns the Underlying Error (UError) message.

func (Error) Error

func (e Error) Error() string

Source Files

Jump to

Keyboard shortcuts

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