sys

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package sys provides cross-platform process management utilities.

This package handles low-level OS-specific operations for process group management, signal handling, and process lifecycle control. It abstracts the differences between Unix (PGID-based) and Windows (taskkill-based) process termination strategies.

The primary purpose is to ensure proper cleanup of CLI processes and their children, preventing zombie processes and resource leaks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignProcessToJob added in v0.9.3

func AssignProcessToJob(jobHandle uintptr, process *os.Process) error

AssignProcessToJob is a no-op on Unix (only used on Windows).

func CloseJobHandle added in v0.9.3

func CloseJobHandle(jobHandle uintptr)

CloseJobHandle is a no-op on Unix (only used on Windows).

func IsProcessAlive

func IsProcessAlive(process *os.Process) bool

IsProcessAlive checks if the process is still running using Signal(0) (Unix).

func KillProcessGroup

func KillProcessGroup(cmd *exec.Cmd, jobHandle uintptr)

KillProcessGroup terminates the entire process tree using the negative PID (Unix). The jobHandle parameter is ignored on Unix (only used on Windows).

func SetupCmdSysProcAttr

func SetupCmdSysProcAttr(cmd *exec.Cmd) (uintptr, error)

SetupCmdSysProcAttr configures the command to run in its own process group (Unix). Returns zero handle (unused on Unix).

Types

This section is empty.

Jump to

Keyboard shortcuts

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