iocommand

package
v0.3.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const IOCommandStderrBufSize = 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type IOCommand

type IOCommand struct {
	Cmd *exec.Cmd

	Stdin      io.WriteCloser
	Stdout     io.ReadCloser
	StderrBuf  *bytes.Buffer
	ExitResult *IOCommandExitResult
	// contains filtered or unexported fields
}

An IOCommand exposes a forked process's std(in|out|err) through the io.ReadWriteCloser interface.

func NewIOCommand

func NewIOCommand(ctx context.Context, command string, args []string, stderrBufSize int) (c *IOCommand, err error)

func RunIOCommand

func RunIOCommand(ctx context.Context, command string, args ...string) (c *IOCommand, err error)

func (*IOCommand) Close

func (c *IOCommand) Close() (err error)

Terminate the child process and collect its exit status It is safe to call Close() multiple times.

func (*IOCommand) Read

func (c *IOCommand) Read(buf []byte) (n int, err error)

Read from process's stdout. The behavior after Close()ing is undefined

func (*IOCommand) Start

func (c *IOCommand) Start() (err error)

func (*IOCommand) Write

func (c *IOCommand) Write(buf []byte) (n int, err error)

Write to process's stdin. The behavior after Close()ing is undefined

type IOCommandError

type IOCommandError struct {
	WaitErr error
	Stderr  []byte
}

func (IOCommandError) Error

func (e IOCommandError) Error() string

type IOCommandExitResult

type IOCommandExitResult struct {
	Error      error
	WaitStatus syscall.WaitStatus
}

Jump to

Keyboard shortcuts

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