cmdutil

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckContextAndAppendStepLogFile

func CheckContextAndAppendStepLogFile(ctx context.Context, data []byte) (bool, error)

CheckContextAndAppendStepLogFile checks whether the context contains instance data and append data to log file.

func CheckContextAndGetStepLogFile

func CheckContextAndGetStepLogFile(ctx context.Context) (*os.File, bool, error)

CheckContextAndGetStepLogFile checks whether the context contains instance data. Caution: when check is true, you should close the file descriptor.

func CmdPipeline

func CmdPipeline(cmds ...*exec.Cmd) (pipeLineOutput, collectedStandardError []byte, pipeLineError error)

CmdPipeline run pipe command like cat a | grep -i "bla"

Types

type ExecCmd

type ExecCmd struct {
	*exec.Cmd
	// contains filtered or unexported fields
}

func NewExecCmd

func NewExecCmd(ctx context.Context, command string, args ...string) *ExecCmd

func RunCmd

func RunCmd(dryRun bool, command string, args ...string) (*ExecCmd, error)

func RunCmdWithContext

func RunCmdWithContext(ctx context.Context, dryRun bool, command string, args ...string) (*ExecCmd, error)

func (*ExecCmd) CommandString

func (ec *ExecCmd) CommandString() string

String returns a human-readable description of command

func (*ExecCmd) Marshal

func (ec *ExecCmd) Marshal() ([]byte, error)

Marshal merges stdout & stderr and returns bytes slice

func (*ExecCmd) Run

func (ec *ExecCmd) Run() error

func (*ExecCmd) SetStderrMultiWriter

func (ec *ExecCmd) SetStderrMultiWriter(writers ...io.Writer) *ExecCmd

SetStderrMultiWriter with multi stderr writer

func (*ExecCmd) SetStdoutMultiWriter

func (ec *ExecCmd) SetStdoutMultiWriter(writers ...io.Writer) *ExecCmd

SetStdoutMultiWriter with multi stdout writer

func (*ExecCmd) StdErr

func (ec *ExecCmd) StdErr() string

func (*ExecCmd) StdOut

func (ec *ExecCmd) StdOut() string

Jump to

Keyboard shortcuts

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