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 (#311)
* fix: Suppress non-PMG error from Critical UI Error * fix: Code review fixes --------- Co-authored-by: Sahil Bansal <bansalsahil315@gmail.com>
This commit is contained in:
co-authored by
Sahil Bansal
parent
db1a5e58b3
commit
5018f8e2ff
@@ -0,0 +1,19 @@
|
||||
//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
|
||||
}
|
||||
Reference in New Issue
Block a user