executor

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package executor executor heavily inspired from the Executor from github.com/rook/rook/pkg/util/exec pkg

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandExecutor

type CommandExecutor struct {
	Executor
	// contains filtered or unexported fields
}

CommandExecutor Executor implementation

func (CommandExecutor) ExecuteCommand

func (ce CommandExecutor) ExecuteCommand(ctx context.Context, actionName string, command string, arg ...string) error

ExecuteCommand execute a given command with its arguments but don't return any output

func (CommandExecutor) ExecuteCommandWithOutput

func (ce CommandExecutor) ExecuteCommandWithOutput(ctx context.Context, actionName string, command string, arg ...string) (string, error)

ExecuteCommandWithOutput execute a given command with its arguments and return the output as a string

func (CommandExecutor) ExecuteCommandWithOutputByte

func (ce CommandExecutor) ExecuteCommandWithOutputByte(ctx context.Context, actionName string, command string, arg ...string) ([]byte, error)

ExecuteCommandWithOutputByte execute a given command with its arguments and return the output as a byte array ([]byte)

func (CommandExecutor) SetEnv

func (ce CommandExecutor) SetEnv(e []string)

SetEnv set env for command execution

type Executor

type Executor interface {
	ExecuteCommand(ctx context.Context, actionName string, command string, arg ...string) error
	ExecuteCommandWithOutput(ctx context.Context, actionName string, command string, arg ...string) (string, error)
	ExecuteCommandWithOutputByte(ctx context.Context, actionName string, command string, arg ...string) ([]byte, error)
	SetEnv([]string)
}

Executor heavily inspired from the Executor from github.com/rook/rook/pkg/util/exec pkg

func NewCommandExecutor

func NewCommandExecutor(logger *zap.Logger, pkg string) Executor

NewCommandExecutor create and return a new CommandExecutor

Directories

Path Synopsis
Package test mock executor heavily inspired from the Executor from github.com/rook/rook/pkg/util/exec pkg#
Package test mock executor heavily inspired from the Executor from github.com/rook/rook/pkg/util/exec pkg#

Jump to

Keyboard shortcuts

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