In the code example for os/signal/#Notify,
signal.Notify(c, os.Interrupt, os.Kill)
tries to catch os.Kill signal, which doesn't work on Linux platforms.
Steps to reproduce:
Code is taken from the doc.
$ cat kill.go
package main
import (
"fmt"
"os"
"os/signal"
)
func main() {
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill)
s := <-c
fmt.Println("Got signal ", s)
}
$ go build kill.go
$ ./kill &
[1] 10300
$ kill -KILL $!
$
[1]+ Killed ./kill
Ctrl-C / -s SIGINT works fine but SIGKILL is not caught.
In the code example for os/signal/#Notify,
tries to catch os.Kill signal, which doesn't work on Linux platforms.
Steps to reproduce:
Code is taken from the doc.
Ctrl-C / -s SIGINT works fine but SIGKILL is not caught.