executable

package
v0.2.39 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executable

type Executable struct {
	Path                  string
	TimeoutInMilliseconds int

	// WorkingDir can be set before calling Start or Run to customize the working directory of the executable.
	WorkingDir string

	StdinPipe io.WriteCloser
	// contains filtered or unexported fields
}

Executable represents a program that can be executed

func NewExecutable

func NewExecutable(path string) *Executable

NewExecutable returns an Executable

func NewVerboseExecutable

func NewVerboseExecutable(path string, loggerFunc func(string)) *Executable

NewVerboseExecutable returns an Executable struct with a logger configured

func (*Executable) Clone added in v0.2.12

func (e *Executable) Clone() *Executable

func (*Executable) HasExited

func (e *Executable) HasExited() bool

func (*Executable) Kill

func (e *Executable) Kill() error

Kill terminates the program

func (*Executable) Run

func (e *Executable) Run(args ...string) (ExecutableResult, error)

Run starts the specified command, waits for it to complete and returns the result.

func (*Executable) RunWithStdin

func (e *Executable) RunWithStdin(stdin []byte, args ...string) (ExecutableResult, error)

RunWithStdin starts the specified command, sends input, waits for it to complete and returns the result.

func (*Executable) Start

func (e *Executable) Start(args ...string) error

Start starts the specified command but does not wait for it to complete.

func (*Executable) Wait

func (e *Executable) Wait() (ExecutableResult, error)

Wait waits for the program to finish and results the result

type ExecutableResult

type ExecutableResult struct {
	Stdout   []byte
	Stderr   []byte
	ExitCode int
}

ExecutableResult holds the result of an executable run

Jump to

Keyboard shortcuts

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