proc

package
v0.19.6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Overview

Package proc is process utilities

Index

Constants

This section is empty.

Variables

View Source
var ErrTimedOut = errors.New("child timed out")

ErrTimedOut is an error for child timeout

View Source
var IntTimeout = 3 * time.Second

IntTimeout is the duration to wait before Kill after Int

View Source
var Log = func(keyvals ...interface{}) error { return nil }

Log is discarded by default

Functions

func GroupKill

func GroupKill(pid int, signal os.Signal) error

GroupKill kills the process group lead by the given pid

func KillWithChildren

func KillWithChildren(p *os.Process, interrupt bool) (err error)

KillWithChildren kills the process and tries to kill its all children (process group)

func Pkill

func Pkill(pid int, signal os.Signal) error

Pkill kills the process with the given pid, or just -INT if interrupt is true.

func RunWithTimeout

func RunWithTimeout(timeoutSeconds int, cmd *exec.Cmd) error

RunWithTimeout runs cmd, and kills the child on timeout

func WithTimeout

func WithTimeout(timeoutSeconds int, todo func() error, onTimeout func() error) error

WithTimeout starts todo function, executes onTimeout if the todo function does not return before timeoutSeconds elapses, and returns todo's returned error or ErrTimedOut

Types

This section is empty.

Jump to

Keyboard shortcuts

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