Browse code

make pkg pidfile support darwin

Signed-off-by: allencloud <allen.sun@daocloud.io>

allencloud authored on 2016/08/01 21:03:50
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+// +build darwin
1
+
2
+package pidfile
3
+
4
+import (
5
+	"syscall"
6
+)
7
+
8
+func processExists(pid int) bool {
9
+	// OS X does not have a proc filesystem.
10
+	// Use kill -0 pid to judge if the process exists.
11
+	err := syscall.Kill(pid, 0)
12
+	if err != nil {
13
+		return false
14
+	}
15
+
16
+	return true
17
+}
... ...
@@ -1,4 +1,4 @@
1
-// +build !windows
1
+// +build !windows,!darwin
2 2
 
3 3
 package pidfile
4 4