I have the following code:
func HandleSIGHUP() chan os.Signal {
sig := make(chan os.Signal, 1)
signal.Notify(sig, syscall.SIGHUP)
return sig
}
I "register" the signal like so:
go func() {
for {
<-HandleSIGHUP()
// do something
}
}()
The problem that I'm experiencing is that I'm only able to catch one SIGHUP. For example if I send multiple kill -SIGHUP <pid> to the process, the "register" code only runs once. How can I get it to run every time the signal is sent?
$ go version
go version go1.4.2 linux/amd64
I also posted this here: http://stackoverflow.com/questions/31395761/handle-signal-multiple-times-in-golang
I have the following code:
I "register" the signal like so:
The problem that I'm experiencing is that I'm only able to catch one SIGHUP. For example if I send multiple
kill -SIGHUP <pid>to the process, the "register" code only runs once. How can I get it to run every time the signal is sent?I also posted this here: http://stackoverflow.com/questions/31395761/handle-signal-multiple-times-in-golang