Files
pmg/internal/proc/signal_unix.go
T
5018f8e2ff fix: Suppress non-PMG error from Critical UI Error (#311)
* fix: Suppress non-PMG error from Critical UI Error

* fix: Code review fixes

---------

Co-authored-by: Sahil Bansal <bansalsahil315@gmail.com>
2026-05-29 14:49:53 +00:00

20 lines
697 B
Go

//go:build !windows
// Package proc decodes process termination status. It is a leaf utility shared
// by the execution layer (runner) and the PTY session, so neither has to
// reach through wrapper layers to learn how a child process ended.
package proc
import "syscall"
// SignalInfo reports whether a process was terminated by a signal, given the
// platform-specific status from (*exec.ExitError).Sys() / (*ptyx.ExitError).Sys().
// signum is the signal number; callers form the conventional exit code as 128+signum.
func SignalInfo(sys any) (signum int, signaled bool) {
ws, ok := sys.(syscall.WaitStatus)
if !ok || !ws.Signaled() {
return 0, false
}
return int(ws.Signal()), true
}