The signal os.Kill cann't be caught or ignored, at least in Unix
systems.
http://linuxtipsblog.com/?p=39
And here you've the test:
Presumably signals can be send as well as received.
Chris
--
Chris "allusive" Dollin
So the question - should it print something when I do "kill [pid]" or the behavior is correct?
So the question - should it print something when I do "kill [pid]" or the behavior is correct?
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
)
func main() {
// Set up channel on which to send signal notifications.
// We must use a buffered channel or risk missing the signal
// if we're not ready to receive when the signal is sent.
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGTERM)
// Block until a signal is received.
s := <-c
fmt.Printf("Got signal: %v\n", s)
}