cmdexec

package
v0.0.0-...-58d9a08 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InjectCheckInterval = time.Millisecond * 200

	ExecWait  = "wait"
	ExecStart = "start"
	ExecRun   = "run"
)

Variables

This section is empty.

Functions

func CpContainerFile

func CpContainerFile(ctx context.Context, cr, containerID, src, dst string) error

func ExecBackGroundCommon

func ExecBackGroundCommon(ctx context.Context, cr, cId, cmd string) error

func ExecCommonWithNS

func ExecCommonWithNS(ctx context.Context, cr, cId, cmd string, ns []string) (string, error)

func ExecContainer

func ExecContainer(ctx context.Context, cr, containerID string, namespaces []string, cmd string, method string) (string, error)

func RunBashCmdWithOutput

func RunBashCmdWithOutput(ctx context.Context, cmd string) (string, error)

func RunBashCmdWithoutOutput

func RunBashCmdWithoutOutput(ctx context.Context, cmd string) error

func StartBashCmd

func StartBashCmd(ctx context.Context, cmd string) error

func StartBashCmdAndWaitByUser

func StartBashCmdAndWaitByUser(ctx context.Context, cmd, user string) error

func StartBashCmdAndWaitPid

func StartBashCmdAndWaitPid(ctx context.Context, cmd string, timeoutSec int) (int, error)

func StartSleepRecover

func StartSleepRecover(ctx context.Context, sleepTime int64, uid string) error

func SupportCmd

func SupportCmd(cmd string) bool

func WaitCommonWithNS

func WaitCommonWithNS(ctx context.Context, cr, cId, cmd string, ns []string) error

Types

type CmdExecutor

type CmdExecutor struct {
	ContainerId      string
	ContainerRuntime string
	ContainerNs      []string
	ToolKey          string
	Method           string
	Fault            string
	Args             string
}

func (*CmdExecutor) ExecTool

func (e *CmdExecutor) ExecTool(ctx context.Context) error

func (*CmdExecutor) GetTargetPid

func (e *CmdExecutor) GetTargetPid(ctx context.Context) (int, error)

func (*CmdExecutor) StartCmd

func (e *CmdExecutor) StartCmd(ctx context.Context, cmd string) error

func (*CmdExecutor) StartCmdAndWait

func (e *CmdExecutor) StartCmdAndWait(ctx context.Context, cmd string) error

Jump to

Keyboard shortcuts

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