subprocess

package
v0.0.0-...-b84de06 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotRunning = fmt.Errorf("The process isn't running")

ErrNotRunning is returned when performing an action against a stopped process.

Functions

This section is empty.

Types

type Process

type Process struct {
	Name     string   `yaml:"name"`
	Args     []string `yaml:"args,flow"`
	Apparmor string   `yaml:"apparmor"`
	Pid      int64    `yaml:"pid"`
	Stdout   string   `yaml:"stdout"`
	Stderr   string   `yaml:"stderr"`
	// contains filtered or unexported fields
}

Process struct. Has ability to set runtime arguments

func ImportProcess

func ImportProcess(path string) (*Process, error)

ImportProcess imports a saved process into a subprocess object.

func NewProcess

func NewProcess(name string, args []string, stdoutPath string, stderrPath string) (*Process, error)

NewProcess is a constructor for a process object. Represents a process with argument config. Returns an address to process

func (*Process) GetPid

func (p *Process) GetPid() (int64, error)

GetPid returns the pid for the given process object

func (*Process) Reload

func (p *Process) Reload() error

Reload sends the SIGHUP signal to the given process object

func (*Process) Restart

func (p *Process) Restart() error

Restart stop and starts the given process object

func (*Process) Save

func (p *Process) Save(path string) error

Save will save the given process object to a YAML file. Can be imported at a later point.

func (*Process) SetApparmor

func (p *Process) SetApparmor(profile string)

SetApparmor allows setting the AppArmor profile.

func (*Process) Signal

func (p *Process) Signal(signal int64) error

Signal will send a signal to the given process object given a signal value

func (*Process) Start

func (p *Process) Start() error

Start will start the given process object

func (*Process) Stop

func (p *Process) Stop() error

Stop will stop the given process object

func (*Process) Wait

func (p *Process) Wait() (int64, error)

Wait will wait for the given process object exit code

Jump to

Keyboard shortcuts

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