diff options
author | Martin Ashby <martin@ashbysoft.com> | 2018-05-21 09:53:17 +0000 |
---|---|---|
committer | Martin Ashby <martin@ashbysoft.com> | 2018-05-21 09:53:17 +0000 |
commit | e0f421115d4319de7585726bac7973e52a34aa67 (patch) | |
tree | 7a1861608f015bf14a6e3fb69f62adae0af2603b /unicorn/RealUnicorn.go | |
parent | 6d8b1fc33ef7ae1bbb6050bb8acb60b4ca7e6da1 (diff) | |
parent | 90aec54d0045d7a9b4ac837a03447684ecdc46e6 (diff) | |
download | unicornpaint-e0f421115d4319de7585726bac7973e52a34aa67.tar.gz unicornpaint-e0f421115d4319de7585726bac7973e52a34aa67.tar.bz2 unicornpaint-e0f421115d4319de7585726bac7973e52a34aa67.tar.xz unicornpaint-e0f421115d4319de7585726bac7973e52a34aa67.zip |
Merge branch 'master' of github.com:MFAshby/unicornpaint
Diffstat (limited to 'unicorn/RealUnicorn.go')
-rw-r--r-- | unicorn/RealUnicorn.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/unicorn/RealUnicorn.go b/unicorn/RealUnicorn.go index fb10a79..b3c1df3 100644 --- a/unicorn/RealUnicorn.go +++ b/unicorn/RealUnicorn.go @@ -6,6 +6,8 @@ import ( "github.com/ecc1/spi" "log" "os" + "os/signal" + "syscall" ) type RealUnicorn struct { @@ -65,9 +67,9 @@ func (u *RealUnicorn) Close() error { // MainLoop ... // Do nothing until SIGTERM, then close the SPI library -func MainLoop() { +func (u *RealUnicorn) MainLoop() { c := make(chan os.Signal, 2) signal.Notify(c, os.Interrupt, syscall.SIGTERM) - <- c - Close() + <-c + u.Close() } |