exec

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunProcess

func RunProcess(
	file string,
	args []string,
	env []string,
	stdin io.Reader,
) (stdout []byte, stderr []byte, code int, err error)

RunProcess executes file, setting up environment using the provided env values. It waits for the process to finish and returns the stdout, stderr and return code.

func StartProcess

func StartProcess(
	file string,
	args []string,
	env []string,
	started ProcessStartedFunc,
) error

StartProcess executes file, setting up the environment using the provided env values. If the function parameter started is not nil, it is invoked on a goroutine after the process has been started.

func StopProcess

func StopProcess(pid int) error

StopProcess finds a process with the given pid and kills it.

func WaitProcess

func WaitProcess(pid int, stopped ProcessStoppedFunc) error

WaitProcess finds a process with the given pid and waits for it to exit. If the function parameter stopped is not nil, it is invoked on a goroutine when the process exits.

Types

type ProcessStartedFunc

type ProcessStartedFunc func(pid int, stdout, stderr io.ReadCloser)

type ProcessStoppedFunc

type ProcessStoppedFunc func(pid int, state *os.ProcessState)

Jump to

Keyboard shortcuts

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