Documentation
¶
Overview ¶
Package procutil provides shared process helpers for AGH runtime components.
Index ¶
- func Alive(pid int) bool
- func ConfigureCommandProcessGroup(cmd *exec.Cmd)
- func FilteredDaemonEnv(base []string) []string
- func IsolatedDaemonEnv(base []string) []string
- func KillCommandProcessGroupAndWait(cmd *exec.Cmd, timeout time.Duration) error
- func KillProcessGroupIDAndWait(pgid int, timeout time.Duration) error
- func MatchesStartTime(pid int, startedAt time.Time) bool
- func RegisterCommandProcessGroup(_ *exec.Cmd) error
- func SensitiveEnvName(name string) bool
- func Signal(pid int, sig syscall.Signal) error
- func SignalCommandProcessGroup(cmd *exec.Cmd, sig syscall.Signal) error
- func SignalProcessGroupID(pgid int, sig syscall.Signal) error
- func StartedAt(pid int) (time.Time, error)
- func WaitForCommandProcessGroupExit(cmd *exec.Cmd, timeout time.Duration) error
- func WaitForProcessGroupIDExit(pgid int, timeout time.Duration) error
- type DetachedLaunchRequest
- type DetachedProcess
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureCommandProcessGroup ¶
ConfigureCommandProcessGroup starts the command in its own process group so callers can signal and observe the full descendant tree.
func FilteredDaemonEnv ¶
FilteredDaemonEnv returns process environment entries safe to pass to child processes.
func IsolatedDaemonEnv ¶
IsolatedDaemonEnv returns only the fixed operational environment allowlist needed to launch local subprocesses. It intentionally drops all non-allowlisted daemon variables, including provider CLI credentials.
func KillCommandProcessGroupAndWait ¶
KillCommandProcessGroupAndWait forcefully terminates any remaining members of the command's process group, then waits for the group to disappear.
func KillProcessGroupIDAndWait ¶
KillProcessGroupIDAndWait forcefully terminates any remaining members of a process group.
func MatchesStartTime ¶
MatchesStartTime reports whether pid currently belongs to a process whose observed start time matches the recorded value closely enough to account for launcher-vs-kernel timestamp skew.
func RegisterCommandProcessGroup ¶
RegisterCommandProcessGroup keeps Unix parity with Windows job registration.
func SensitiveEnvName ¶
SensitiveEnvName reports whether an environment variable name commonly carries credentials.
func SignalCommandProcessGroup ¶
SignalCommandProcessGroup delivers sig to the command's process group.
func SignalProcessGroupID ¶
SignalProcessGroupID delivers sig to the process group identified by pgid.
func WaitForCommandProcessGroupExit ¶
WaitForCommandProcessGroupExit blocks until the command's process group no longer exists, which ensures descendants are gone before returning.
Types ¶
type DetachedLaunchRequest ¶
DetachedLaunchRequest describes one detached process launch with log capture.
type DetachedProcess ¶
type DetachedProcess struct {
// contains filtered or unexported fields
}
DetachedProcess wraps a detached child process whose stderr/stdout were appended to a log file.
func SpawnDetachedLoggedProcess ¶
func SpawnDetachedLoggedProcess( ctx context.Context, req DetachedLaunchRequest, ) (*DetachedProcess, error)
SpawnDetachedLoggedProcess launches one detached child process whose stdout/stderr are appended to req.LogPath.
func (*DetachedProcess) Done ¶
func (p *DetachedProcess) Done() <-chan struct{}
Done closes after the detached child has been reaped.
func (*DetachedProcess) PID ¶
func (p *DetachedProcess) PID() int
PID reports the launched process id.
func (*DetachedProcess) Wait ¶
func (p *DetachedProcess) Wait() error
Wait blocks until the detached process exits and attaches recent log output to failures.