astiexec

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2018 License: MIT Imports: 8 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Exec = func(cmd *Cmd) (o []byte, d time.Duration, err error) {

	defer func(t time.Time) {
		d = time.Since(t)
	}(time.Now())

	execCmd := exec.CommandContext(cmd.ctx, cmd.Args[0], cmd.Args[1:]...)

	astilog.Debugf("Executing %s", cmd)
	o, err = execCmd.CombinedOutput()
	return
}

Exec executes a command

Functions

Types

type Cmd

type Cmd struct {
	Args []string
	// contains filtered or unexported fields
}

Cmd represents a command

func NewCmd

func NewCmd(ctx context.Context, args ...string) (cmd *Cmd)

NewCmd creates a new command

func (*Cmd) String

func (c *Cmd) String() string

String allows Cmd to implements the stringify interface

type StdWriter

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

StdWriter represents an object capable of writing what's coming out of stdout or stderr

func NewStdWriter

func NewStdWriter(fn func(i []byte)) *StdWriter

NewStdWriter creates a new StdWriter

func (*StdWriter) Close

func (w *StdWriter) Close()

Close closes the writer

func (*StdWriter) Write

func (w *StdWriter) Write(i []byte) (n int, err error)

Write implements the io.Writer interface

Jump to

Keyboard shortcuts

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