cmdexec

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

cmdexec package is wrapper around os/exec and handles common use cases while executing commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Binary string // Full path to the binary to execute
	Args   []string
	Env    []string
	// contains filtered or unexported fields
}

Command is a command to execute.

func NewCommand

func NewCommand(binary string, args ...string) (*Command, error)

NewCommand creates a new command with the provided binary and arguments.

func (*Command) AddVars

func (c *Command) AddVars(vars ...types.Variable)

AddVars adds variables to the command.

func (*Command) EnableDebugMode added in v0.0.3

func (c *Command) EnableDebugMode()

EnableDebugMode enables the debug mode for the command.

func (*Command) Execute

func (c *Command) Execute(ctx context.Context) (*types.Result, error)

Execute executes the command and returns the output.

func (*Command) SetEnv

func (c *Command) SetEnv(env []string)

SetEnv sets the environment variables for the command.

func (*Command) SetStdin

func (c *Command) SetStdin(stdin io.Reader)

SetStdin sets the stdin for the command.

Jump to

Keyboard shortcuts

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