diff options
author | Filippo Valsorda <hi@filippo.io> | 2018-05-20 23:39:25 -0400 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-21 20:22:12 +0200 |
commit | bc05eb1c3c39609f9c76696d7db4f40da36b4817 (patch) | |
tree | a27630b59b56f398f168f99ca7c545d07ab52604 /main.go | |
parent | 7a527f7c89fe7929e2bc2c7e38be4862f24cc494 (diff) |
Minor main.go signal fixes
* Buffer the signal channel as it's non-blocking on the sender side
* Notify on SIGTERM instead of the uncatchable SIGKILL
License: MIT
Signed-off-by: Filippo Valsorda <valsorda@google.com>
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -12,6 +12,7 @@ import ( "os/signal" "runtime" "strconv" + "syscall" ) const ( @@ -236,7 +237,7 @@ func main() { logger.Info.Println("Device started") errs := make(chan error) - term := make(chan os.Signal) + term := make(chan os.Signal, 1) uapi, err := UAPIListen(interfaceName, fileUAPI) if err != nil { @@ -259,7 +260,7 @@ func main() { // wait for program to terminate - signal.Notify(term, os.Kill) + signal.Notify(term, syscall.SIGTERM) signal.Notify(term, os.Interrupt) select { |