process

package
v0.0.0-...-c996816 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: ISC Imports: 3 Imported by: 0

Documentation

Overview

Package process implements an simple alternative to os/exec built above os.Process. It adds the possibility to asynchronously monitor the state of the child process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Process

type Process struct {
	// contains filtered or unexported fields
}

Process represents a child process whose state is monitored.

func Start

func Start(bin string, argv []string) (p *Process, err error)

Start creates a new child process and starts a monitoring routine to keep track of its state.

func (*Process) C

func (p *Process) C() chan int

C retuns a channel which will be notified of the process exit code on its termination.

func (*Process) ExitCode

func (p *Process) ExitCode() int

ExitCode returns the exit code of the process if it exited and panics if the process is still running.

func (*Process) Kill

func (p *Process) Kill() error

Kill forces the process to exit imediately.

func (*Process) Pid

func (p *Process) Pid() int

Pid returns the ID assigned to the process.

func (*Process) Running

func (p *Process) Running() bool

Running returns true if the process has not exited yet.

func (*Process) Signal

func (p *Process) Signal(sig os.Signal) error

Signal sends the given signal to the process.

func (*Process) Uptime

func (p *Process) Uptime() time.Duration

Uptime returns the time since the process started. If the process already exited, Uptime returns the time until termination.

Jump to

Keyboard shortcuts

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