utils

package
v0.0.0-...-8443efe Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ok            = 0
	Warning       = 1
	Critical      = 2
	Unknown       = 3
	Timeout       = 124
	NotExecutable = 126
	NotFound      = 127
)

Unified exit codes

Variables

This section is empty.

Functions

func FileExists

func FileExists(filename string) bool

Types

type CommandArgs

type CommandArgs struct {
	Command string
	Timeout time.Duration
	Shell   string
	Stdin   string
}

type CommandResult

type CommandResult struct {
	Stdout                    string `json:"stdout"`
	RC                        int    `json:"rc"`
	ExecutionUnixTimestampSec int64  `json:"execution_unix_timestamp_sec"`
}

CommandResult to return the information

func RunCommand

func RunCommand(ctx context.Context, commandArgs CommandArgs) (*CommandResult, error)

RunCommand in shell style with timeout on every platform

Jump to

Keyboard shortcuts

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