Files

23 lines
864 B
Go

package session
// ProcessState is the tri-state result of a PID liveness check. The call
// site decides how to treat ProcessUnknown; IsStale treats it
// conservatively by falling back to wall-clock freshness.
type ProcessState int
const (
// ProcessAlive: the OS confirms a process with this PID exists.
ProcessAlive ProcessState = iota
// ProcessDead: the OS confirms no process with this PID exists.
ProcessDead
// ProcessUnknown: the liveness check was inconclusive (permission
// error, unexpected OS error). Callers must NOT treat this as dead.
ProcessUnknown
)
// checkProcess is the test seam for PID liveness. Production code uses the
// platform-specific defaultCheckProcess. Tests override this package-level
// variable; such tests must restore it via t.Cleanup and must NOT run with
// t.Parallel().
var checkProcess = defaultCheckProcess