Documentation
¶
Index ¶
- func FindId(name string) (int, error)
- func FindIds(name string) ([]int, error)
- func FindMainIds(name string) ([]int, error)
- func FindName(pid int) (string, error)
- func FindNames() ([]string, error)
- func FindPath(pid int) (string, error)
- func GetPid() int
- func IsRun(pid int) (bool, error)
- func Kill(pid int) error
- func PidExists(pid int) (bool, error)
- func Pids() ([]int, error)
- func Run(path string) ([]byte, error)
- func Status(pid int) ([]string, error)
- func ToInt(pid []int32) (res []int)
- type Nps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindId ¶ added in v0.43.0
FindId finds the main process by matching the executable path. It looks for a process whose path contains "name" (case insensitive) and prioritizes main binaries (see FindMainIds), excluding helper processes. Returns the PID or -1 if not found.
func FindIds ¶
FindIds finds the all processes named with a subset of "name" (case insensitive), return matched IDs.
func FindMainIds ¶ added in v0.43.0
FindMainIds finds all main process PIDs by matching the executable path. It looks for processes whose path contains "name" (case insensitive) and are main binaries, excluding helper processes:
- macOS: the binary is under .app/Contents/MacOS/
- Windows, Linux and others: the parent process runs a different executable (children of multi-process apps share the parent's binary)
Returns all matching main PIDs, or all matching PIDs if no main one is found.
Types ¶
Click to show internal directories.
Click to hide internal directories.