llps

package module
v0.0.0-...-dc2c509 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 3 Imported by: 0

README

go-llps

Find, list, and inspect processes as a linked list from Go (golang) Go Version Go Reference License Report Card

Inspired by github.com/mitchellh/go-ps

Documentation

Overview

llps provides an API for finding and listing processes in a platform-agnostic way.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoProcessFound = errors.New("no process found")

Functions

func ErrUnableToFindProcess

func ErrUnableToFindProcess(err error) error

ErrUnableToFindProcess is returned when a process is cannot be retrieved.

Types

type Process

type Process struct {
	// Parent is the information about the parent process.
	Parent *Process

	// PID is the process ID for this process.
	PID int

	// Executable name running this process. This is not a path to the executable.
	Executable string
}

Process contains information about a running process.

This is generic to all operating systems supported by github.com/mitchellh/go-ps.

func FindProcess

func FindProcess(pid int) (*Process, error)

FindProcess looks up a single process by pid.

Thid func will send ErrNoProcessFound if a matching process is not found.

func Processes

func Processes() ([]*Process, error)

Processes returns all processes.

This of course will be a point-in-time snapshot of when this method was called. Some operating systems don't provide snapshot capability of the process table, in which case the process table returned might contain ephemeral entities that happened to be running when this was called.

Jump to

Keyboard shortcuts

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