Documentation
¶
Index ¶
- Variables
- type Cmd
- func (c *Cmd) CombinedOutput() ([]byte, error)
- func (c *Cmd) Run() error
- func (c *Cmd) WithDir(dir string) *Cmd
- func (c *Cmd) WithEnv(env []string) *Cmd
- func (c *Cmd) WithSecret(values ...string) *Cmd
- func (c *Cmd) WithStderr(stderr io.Writer) *Cmd
- func (c *Cmd) WithStdin(stdin io.Reader) *Cmd
- func (c *Cmd) WithStdout(stdout io.Writer) *Cmd
- func (c *Cmd) WithTimeout(timeout time.Duration) *Cmd
Constants ¶
This section is empty.
Variables ¶
var ErrCommandTimeout = errors.New("command execute timeout")
Functions ¶
This section is empty.
Types ¶
type Cmd ¶
type Cmd struct {
Name string
Args []string
Timeout time.Duration
Dir string
Env []string
Stdout io.Writer
Stderr io.Writer
Stdin io.Reader
// contains filtered or unexported fields
}
Cmd represents a Cmd to be executed.
func CommandContext ¶
CommandContext creates a new command instance with context.
func NewCommand ¶
NewCommand creates a new command instance.
func (*Cmd) CombinedOutput ¶
CombinedOutput runs the command and returns its combined standard output and standard error.
func (*Cmd) WithSecret ¶ added in v0.6.4
WithSecret marks values that must never be written to a log. An argument equal to one of them is replaced by a placeholder in the debug log; the argument list passed to the process is unchanged. Values are matched exactly and empty values are ignored.
A value is used rather than a flag position on purpose: PlumeImpactor reuses -p for the password of certificate import/export and account login, but for the package path of sign, which is not a secret.
func (*Cmd) WithStderr ¶
WithStderr sets the stderr writer for the command.
func (*Cmd) WithStdout ¶
WithStdout sets the stdout writer for the command.