MCPcopy
hub / github.com/docker/compose / alive

Function alive

internal/pidfile/pidfile_unix.go:30–42  ·  view source on GitHub ↗
(pid int)

Source from the content-addressed store, hash-verified

28)
29
30func alive(pid int) bool {
31 if pid < 1 {
32 return false
33 }
34 switch runtime.GOOS {
35 case "darwin":
36 err := unix.Kill(pid, 0)
37 return err == nil || errors.Is(err, unix.EPERM)
38 default:
39 _, err := os.Stat("/proc/" + strconv.Itoa(pid))
40 return err == nil
41 }
42}

Callers 1

ReadFunction · 0.70

Calls 1

KillMethod · 0.65

Tested by

no test coverage detected