-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignal.go
57 lines (53 loc) · 1.04 KB
/
signal.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import (
"os"
"os/signal"
"syscall"
)
var followedSignals = []os.Signal{
syscall.SIGABRT,
syscall.SIGALRM,
syscall.SIGBUS,
syscall.SIGFPE,
syscall.SIGHUP,
syscall.SIGILL,
syscall.SIGINT,
syscall.SIGKILL,
syscall.SIGPIPE,
syscall.SIGQUIT,
syscall.SIGSEGV,
syscall.SIGTERM,
syscall.SIGTRAP,
}
// func init() {
// if runtime.GOOS != "windows" {
// followedSignals = append(
// followedSignals,
// syscall.SIGUSR1,
// syscall.SIGUSR2,
// syscall.SIGVTALRM,
// syscall.SIGWINCH,
// syscall.SIGXCPU,
// syscall.SIGXFSZ,
// syscall.SIGCHLD,
// syscall.SIGCONT,
// syscall.SIGIO,
// syscall.SIGCHLD,
// syscall.SIGCONT,
// syscall.SIGIO,
// syscall.SIGIOT,
// syscall.SIGPROF,
// syscall.SIGSTOP,
// syscall.SIGSYS,
// syscall.SIGTSTP,
// syscall.SIGTTIN,
// syscall.SIGURG,
// syscall.SIGTTOU)
//
// }
// }
func SubscribeToShutdownSignals() chan os.Signal {
shutdownSignals := make(chan os.Signal)
signal.Notify(shutdownSignals, followedSignals...)
return shutdownSignals
}