mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
* fix: Suppress non-PMG error from Critical UI Error * fix: Code review fixes --------- Co-authored-by: Sahil Bansal <bansalsahil315@gmail.com>
20 lines
697 B
Go
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
|
|
}
|