Help us shape the future of Go! Take the 2026 Go Developer Survey

taskman

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KillProcess

func KillProcess(pid uint32) error

func KillProcessByPort

func KillProcessByPort(port uint16, tree bool) ([]uint32, error)

KillProcessByPort kills every process bound to the port. With tree=true, each process is killed together with all of its descendants.

func KillProcessTree added in v1.1.0

func KillProcessTree(rootPID uint32) ([]uint32, error)

KillProcessTree kills a process and all of its descendants. Descendants are discovered from a single snapshot taken before the first kill, and the root is killed first so it cannot spawn replacements for already-killed children. A descendant that exited before its turn is skipped; its PID is simply absent from the returned list. Only a failure to kill the root is an error.

Types

type PortInfo

type PortInfo struct {
	Protocol   string // "TCP" or "UDP"
	LocalAddr  string
	LocalPort  uint16
	RemoteAddr string // empty for UDP (connectionless)
	RemotePort uint16
	PID        uint32
	State      string // empty for UDP
}

func FindProcessByPort

func FindProcessByPort(port uint16) ([]PortInfo, error)

FindProcessByPort scans TCP and UDP tables over IPv4 and IPv6. A family that fails is skipped as long as at least one family succeeds.

type ProcessDetails added in v1.1.0

type ProcessDetails struct {
	PID             uint32
	Name            string
	ParentPID       uint32
	ThreadCount     uint32
	ExecutablePath  string // empty when access is denied
	CommandLine     string // empty when unavailable (access denied or system process)
	WorkingSetBytes uint64 // 0 when unavailable
	PrivateBytes    uint64 // 0 when unavailable
}

func GetProcessInfo added in v1.1.0

func GetProcessInfo(pid uint32) (*ProcessDetails, error)

GetProcessInfo returns details for one process. Name, parent PID, and thread count always come from the process snapshot; path, command line, and memory usage are best-effort and stay zero-valued when the process cannot be opened (e.g. protected system processes).

type ProcessInfo

type ProcessInfo struct {
	PID       uint32
	Name      string
	ParentPID uint32
	Threads   uint32
}

func ListProcesses

func ListProcesses(filter string) ([]ProcessInfo, error)

Jump to

Keyboard shortcuts

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