Documentation ¶
Overview ¶
Package process contains some utilities to help adapters keep track of processes that start or shut down.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListMatchingProcesses ¶
func ListMatchingProcesses(match string, pe Enumerator) ([]uint32, error)
ListMatchingProcesses lists all IDs for processes that match the given string
Types ¶
type Enumerator ¶
Enumerator defines the interface for enumerating processes on the system
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner polls the system for all running process names that match a given string and emits events to notify of any changes in this list.
func NewScanner ¶
func NewScanner( processName string, scanTicker <-chan time.Time, pe Enumerator, eventBufSize int, logger *zap.Logger, ) *Scanner
NewScanner creates a new process scanner.
- processName is a substring match query for the process name
- scanTicker provides a mechanism for the Scanner to iterate on a given interval
- pe provides the Scanner with an API for enumerating processes
- eventBufSize determines the size of this event channel
- logger provides the scanner with a logger
func (*Scanner) ProcessAddEventListener ¶
ProcessAddEventListener returns a channel on which subscribers can listen for new process events. Scanner does not broadcast events to all subscribers; only one will be notified of a given change.
func (*Scanner) ProcessRemoveEventListener ¶
ProcessRemoveEventListener returns a channel on which subscribers can listen for close process events. Scanner does not broadcast events to all subscribers; only one will be notified of a given change.