procutil

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package procutil provides common utilities related to /proc to be shared across variation of tests.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("process not found")

ErrNotFound is an error returned by Find*() family, if no target process is found.

Functions

func FindAll

func FindAll(m Matcher) ([]*process.Process, error)

FindAll returns a list of all process.Process instances which are matched with the given mathcer. If process it not found, this returns ErrNotFound.

func FindUnique

func FindUnique(m Matcher) (*process.Process, error)

FindUnique returns a process.Process instance which is matched with the given matcher. If not found, or multiple processes satisfy the matcher, this returns an error. Specifically, on not found case, ErrNotFound is returned.

func WaitForTerminated

func WaitForTerminated(ctx context.Context, p *process.Process, timeout time.Duration) error

WaitForTerminated waits for the process p to be terminated.

Types

type Matcher

type Matcher func(p *process.Process) bool

Matcher is the interface to be passed to Find*() family, representing a condition to identify the target process.

func And

func And(ms ...Matcher) Matcher

And is a utility to compose matchers into one matcher, which is satisfied only when all given matchers are satisfied. If nothing is passed, the returned matcher will match with any process.

func ByExe

func ByExe(exePath string) Matcher

ByExe returns a Matcher which will be satisfied if a process's Exe is the same with the given path. exePath should be always absolute path.

Jump to

Keyboard shortcuts

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