feat(v0.6): tri-state PID liveness probe (ProcessAlive/Dead/Unknown)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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
|
||||
Reference in New Issue
Block a user