2016-09-20 21:47:49 +00:00
|
|
|
// +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
|
2016-09-30 10:03:49 +00:00
|
|
|
} else {
|
|
|
|
err := proc.Signal(syscall.Signal(0))
|
|
|
|
if err == nil {
|
|
|
|
return true, nil
|
|
|
|
} else {
|
|
|
|
return false, nil
|
|
|
|
}
|
2016-09-20 21:47:49 +00:00
|
|
|
}
|
|
|
|
}
|