Documentation
¶
Overview ¶
this package provides functions to interact with the os processes You can list all the processes running on the os, filter them via a regexp and then use them from in other masche modules, because they are already open.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllPids ¶
GetAllPids returns a slice with al the running processes' pids.
func ProcessExe ¶
Types ¶
type Process ¶
type Process interface { // Pid returns the process' pid. Pid() int // Name returns the process' binary full path. Name() (name string, harderror error, softerrors []error) // Closes this Process. Close() (harderror error, softerrors []error) // Handle returns an opaque value which's meaning dependes on the OS-specific implementation of it. // It works like an interface{} that you must cast, but we are using a uintptr because we need to return C values, // and casting between them in different modules panics if you use interface{}. Handle() uintptr }
Process type represents a running processes that can be used by other modules. In order to get a Process on of the Open* functions must be called, and once it's not needed it must be closed.
func GetProcess ¶
func OpenAll ¶
OpenAll opens all the running processes returning a slice of Process. A race condition may make this generate some softerrors because from the time pids are get to actually opened some of them may have dead.
func OpenByName ¶
OpenByName recieves a Regexp an returns a slice with all the Processes whose name matches it.
type ProcessInfo ¶
type ProcessInfo interface { GetId() int GetCommand() string GetParentProcessId() int GetExecutable() string }
func GetProcessInfo ¶
func GetProcessInfo(pid int) (*ProcessInfo, error)