exec

package
v0.0.0-...-d3b71cc Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2021 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package exec provides an abstraction around package os' Process implementation for easier testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExitStatus

type ExitStatus struct {
	PID   int
	Code  int // -1 for interrupt
	Error error
}

ExitStatus is a process' exit status.

type Process

type Process interface {
	PID() int
	Signal(os.Signal) error
	Kill() error
	Wait() ExitStatus
}

Process describes a command process.

func FindProcess

func FindProcess(pid int) (Process, error)

FindProcess creates a new Process from an existing process ID.

func NewSleepProcess

func NewSleepProcess(dura, delay time.Duration, pid int) Process

NewSleepProcess creates a process that only idles for a duration. It is used for testing. If delay is larger than 0, then the process will sleep for that delay before exiting, unless it is SIGKILLed.

func StartProcess

func StartProcess(argv []string) (Process, error)

StartProcess creates a new command process on the system.

Jump to

Keyboard shortcuts

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