execute

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: Apache-2.0, UPL-1.0 Imports: 14 Imported by: 0

README

execute library for go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttrExecute

func AttrExecute(attr *syscall.SysProcAttr, name string, arg ...string) (string, string, error)

func AttrExecuteQuiet

func AttrExecuteQuiet(attr *syscall.SysProcAttr, name string, arg ...string) (string, string, error)

func CloseExtraFds

func CloseExtraFds() error

CloseExtraFds closes any open file descriptors other than stdout, stdin, and stderr. This is good hygeine before execing another process.

func EnvExecute

func EnvExecute(env []string, name string, arg ...string) (string, string, error)

func EnvExecuteQuiet

func EnvExecuteQuiet(env []string, name string, arg ...string) (string, string, error)

func Exec

func Exec(name string, arg ...string) error

Exec looks up the binary in the path, closes file descriptors, and execs the binary.

func Execute

func Execute(name string, arg ...string) (string, string, error)

func ExecuteQuiet

func ExecuteQuiet(name string, arg ...string) (string, string, error)

func IsTerminal

func IsTerminal(fd uintptr) bool

IsTerminal returns true if the given file descriptor is a terminal.

func TimedExecute

func TimedExecute(timeout int, env []string, name string, arg ...string) (string, string, error)

func TimedExecuteQuiet

func TimedExecuteQuiet(timeout int, env []string, name string, arg ...string) (string, string, error)

func WaitExit

func WaitExit(timeout int, cmd *exec.Cmd, commandLine string, quiet bool) error

WaitExit will steal the first SIGINT, SIGTERM or SIGHUP in non-quiet mode and pass them through to the executed process.

Types

type Colorizer

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

Colorizer is an io.Writer that colorizes console output.

func (*Colorizer) Write

func (b *Colorizer) Write(buf []byte) (n int, err error)

Write wraps the write to the underlying io.Writer with color escape codes.

type SignalExit

type SignalExit struct {
	CommandLine string
	Signal      syscall.Signal
}

SignalExit means the command exited via signal

func (SignalExit) Error

func (s SignalExit) Error() string

type StatusExit

type StatusExit struct {
	CommandLine string
	Status      int
}

StatusExit means the command exited with a non-zero exit code

func (StatusExit) Error

func (s StatusExit) Error() string

Jump to

Keyboard shortcuts

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