-
Notifications
You must be signed in to change notification settings - Fork 21
/
starter_any.go
43 lines (38 loc) · 948 Bytes
/
starter_any.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// +build !windows
package starter
import (
"os"
"syscall"
)
func init() {
failureStatus = syscall.WaitStatus(255)
successStatus = syscall.WaitStatus(0)
}
func addPlatformDependentNiceSigNames(v map[syscall.Signal]string) map[syscall.Signal]string {
v[syscall.SIGCHLD] = "CHLD"
v[syscall.SIGCONT] = "CONT"
v[syscall.SIGIO] = "IO"
v[syscall.SIGPROF] = "PROF"
v[syscall.SIGSTOP] = "STOP"
v[syscall.SIGSYS] = "SYS"
v[syscall.SIGTSTP] = "TSTP"
v[syscall.SIGTTIN] = "TTIN"
v[syscall.SIGTTOU] = "TTOU"
v[syscall.SIGURG] = "URG"
v[syscall.SIGUSR1] = "USR1"
v[syscall.SIGUSR2] = "USR2"
v[syscall.SIGVTALRM] = "VTALRM"
v[syscall.SIGWINCH] = "WINCH"
v[syscall.SIGXCPU] = "XCPU"
v[syscall.SIGXFSZ] = "GXFSZ"
return v
}
func findWorker(pid int) *os.Process {
var wstatus syscall.WaitStatus
waitpid, _ := syscall.Wait4(pid, &wstatus, syscall.WNOHANG, nil)
if waitpid <= 0 {
p, _ := os.FindProcess(pid)
return p
}
return nil
}