MCPcopy Create free account
hub / github.com/JordanCoin/codemap / processAlive

Function processAlive

watch/process_unix.go:24–33  ·  view source on GitHub ↗

processAlive reports whether a process with the given PID is currently running. FindProcess always succeeds on Unix, so liveness is probed with signal 0.

(pid int)

Source from the content-addressed store, hash-verified

22// running. FindProcess always succeeds on Unix, so liveness is probed with
23// signal 0.
24func processAlive(pid int) bool {
25 if pid <= 0 {
26 return false
27 }
28 proc, err := os.FindProcess(pid)
29 if err != nil {
30 return false
31 }
32 return proc.Signal(syscall.Signal(0)) == nil
33}
34
35// terminateDaemon stops the daemon on Unix with SIGTERM so it can shut down
36// gracefully. This matches long-standing behavior and does not gate on

Callers 2

IsRunningFunction · 0.70

Calls

no outgoing calls

Tested by 1