MCPcopy Index your code
hub / github.com/coder/agentapi / isProcessRunning

Function isProcessRunning

cmd/server/process_unix.go:12–19  ·  view source on GitHub ↗

isProcessRunning checks if a process with the given PID is running.

(pid int)

Source from the content-addressed store, hash-verified

10
11// isProcessRunning checks if a process with the given PID is running.
12func isProcessRunning(pid int) bool {
13 process, err := os.FindProcess(pid)
14 if err != nil {
15 return false
16 }
17 err = process.Signal(syscall.Signal(0))
18 return err == nil || errors.Is(err, syscall.EPERM)
19}

Callers 1

writePIDFileFunction · 0.70

Calls 1

SignalMethod · 0.80

Tested by

no test coverage detected