exechelper

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 11 Imported by: 9

Documentation

Index

Constants

View Source
const (
	DefaultExitCodeOnError = 128
)

Error code for non exec error

Variables

This section is empty.

Functions

func DoHeadless

func DoHeadless(command []string, env map[string]string) (int, error)

func Lookup added in v0.3.1

func Lookup(bin string, extraLookupPaths []string) (string, error)

func Prepare

func Prepare(s Spec) (*exec.Cmd, error)

Prepare an unstarted exec.Cmd

func StartNoLookPath added in v0.9.0

func StartNoLookPath(cmd *exec.Cmd) error

StartNoLookPath starts cmd without path looking up path with extensions (special behaivor on windows in original stdlib)

Types

type Cmd added in v0.3.1

type Cmd struct {
	ExecCmd *exec.Cmd

	// stdin/stdout set when created with tty enabled
	TtyInput  io.WriteCloser
	TtyOutput io.ReadCloser
	// contains filtered or unexported fields
}

func Do

func Do(s Spec) (*Cmd, error)

Do execute command directly in local host

func (*Cmd) Release added in v0.3.1

func (c *Cmd) Release() error

Release process if wait was not called and you want to terminate it

func (*Cmd) Resize added in v0.3.1

func (c *Cmd) Resize(cols, rows uint32) error

Resize tty windows if was created with tty enabled

func (*Cmd) Wait added in v0.3.1

func (c *Cmd) Wait() (int, error)

Wait until command exited

type Spec

type Spec struct {
	Context context.Context

	// set working directory when running the command
	Dir string

	Env         map[string]string
	Command     []string
	SysProcAttr *syscall.SysProcAttr

	ExtraLookupPaths []string

	// stdin/stdout/stderr streams, not used if Tty is set to true
	Stdin          io.Reader
	Stdout, Stderr io.Writer

	Tty bool
}

Jump to

Keyboard shortcuts

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