diff --git a/main.go b/main.go index 7d545fe..b50d1e1 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,8 @@ import ( _ "image/jpeg" "log" "os" + "os/signal" + "syscall" "time" rgbmatrix "gitea.wagshome.duckdns.org/publicWagsHome/go-rpi-rgb-led-matrix" @@ -76,6 +78,18 @@ func main() { log.Println("making animator") go animator(tk, mqMessages) log.Println("I guess I'm at the end") + sigs := make(chan os.Signal, 1) + signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) + done := make(chan bool, 1) + go func() { + sig := <-sigs + fmt.Println() + fmt.Println(sig) + done <- true + }() + fmt.Println("awaiting signal") + <-done + fmt.Println("exiting") } func listener(mqMessages chan mqtt.Message) {