mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-13 09:04:06 -08:00
21 lines
331 B
Go
21 lines
331 B
Go
|
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
||
|
|
||
|
package lockfile
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"syscall"
|
||
|
)
|
||
|
|
||
|
func isRunning(pid int) (bool, error) {
|
||
|
proc, err := os.FindProcess(pid)
|
||
|
if err != nil {
|
||
|
return false, err
|
||
|
}
|
||
|
|
||
|
if err := proc.Signal(syscall.Signal(0)); err != nil {
|
||
|
return false, nil
|
||
|
}
|
||
|
return true, nil
|
||
|
}
|