2016-08-01 12:03:50 +00:00
|
|
|
// +build darwin
|
|
|
|
|
|
|
|
package pidfile
|
|
|
|
|
|
|
|
import (
|
2017-05-23 14:22:32 +00:00
|
|
|
"golang.org/x/sys/unix"
|
2016-08-01 12:03:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func processExists(pid int) bool {
|
|
|
|
// OS X does not have a proc filesystem.
|
|
|
|
// Use kill -0 pid to judge if the process exists.
|
2017-05-23 14:22:32 +00:00
|
|
|
err := unix.Kill(pid, 0)
|
2016-12-13 20:10:11 +00:00
|
|
|
return err == nil
|
2016-08-01 12:03:50 +00:00
|
|
|
}
|