run

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: GPL-3.0 Imports: 15 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HandleInterruptEvent = func(handler func() bool) error { return nil }

os specific interrupt handler where additional handling is required to trap ctrl-c events. does nothing for *nix platforms. handler should return true if event is handled and propagation to other handlers in chaing should stop.

Functions

func AddCliNameMapping

func AddCliNameMapping(cliName string, targetCliName string)

hook to transform a cli name to a system local specific name. i.e. a binary named foo in linux maybe name foo.exe in windows.

func AddCliSearchPaths

func AddCliSearchPaths(cliName string, searchPaths ...string)

hook to provide a list of paths to refer for the cli binary before attempting to locate it in the system path

func IsAdmin

func IsAdmin() (bool, error)

func LookupFilePathInSystem

func LookupFilePathInSystem(fileName string) (string, error)

looks for the given file within the system path as set in the environment

func RunAsAdmin

func RunAsAdmin(outputBuffer, errorBuffer io.Writer) error

func RunAsAdminWithArgs

func RunAsAdminWithArgs(cmdArgs []string, outputBuffer, errorBuffer io.Writer) error

func TerminateProcess

func TerminateProcess(psRE string, outputBuffer, errorBuffer io.Writer) error

Types

type CLI

type CLI interface {
	ExecutablePath() string
	WorkingDirectory() string

	ApplyFilter(filter *streams.Filter)
	GetPipedOutputBuffer() io.Reader
	GetPipedErrorBuffer() io.Reader

	Run(args []string) error
	RunWithEnv(args []string, extraEnvVars []string) error

	Start(args []string) error
	StartWithEnv(args []string, extraEnvVars []string) error

	Wait(timeout ...time.Duration) error
	Stop(timeout ...time.Duration) error
}

func CreateCLI

func CreateCLI(cliName string, outputBuffer, errorBuffer io.Writer) (CLI, string, error)

creates a CLI by locating within the filesystem and system path.

func NewCLI

func NewCLI(
	executablePath string,
	workingDirectory string,
	outputBuffer, errorBuffer io.Writer,
) (CLI, error)

Jump to

Keyboard shortcuts

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