command

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitStatus

func ExitStatus(err error) (int, bool)

ExitStatus will return the exit-code from an error returned by Wait().

func GitPath

func GitPath() string

GitPath returns the path to the `git` binary. See `SetGitPath` for details on how this is set

func WaitAllDone added in v0.40.0

func WaitAllDone()

WaitAllDone waits for all commands started by the command package to finish. This can only be called once in the lifecycle of the current Go process.

Types

type Command

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

Command encapsulates a running exec.Cmd. The embedded exec.Cmd is terminated and reaped automatically when the context.Context that created it is canceled.

func GitlabShell

func GitlabShell(ctx context.Context, envs []string, executable string, args ...string) (*Command, error)

GitlabShell creates a gitlab-shell Command with the given args

func New

func New(ctx context.Context, cmd *exec.Cmd, stdin io.Reader, stdout, stderr io.Writer, env ...string) (*Command, error)

New creates a Command from an exec.Cmd. On success, the Command contains a running subprocess. When ctx is canceled the embedded process will be terminated and reaped automatically.

func (*Command) Read added in v0.40.0

func (c *Command) Read(p []byte) (int, error)

Read calls Read() on the stdout pipe of the command.

func (*Command) Wait added in v0.40.0

func (c *Command) Wait() error

Wait calls Wait() on the exec.Cmd instance inside the command. This blocks until the command has finished and reports the command exit status via the error return value. Use ExitStatus to get the integer exit status from the error returned by Wait().

Jump to

Keyboard shortcuts

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