Fix unbuffered os.Signal channel error
This commit is contained in:
parent
11110fb66b
commit
5a901eada3
2
main.go
2
main.go
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
// WaitForSignal Waits (blocking) for the program to be interrupted by the OS
|
// WaitForSignal Waits (blocking) for the program to be interrupted by the OS
|
||||||
func WaitForSignal() {
|
func WaitForSignal() {
|
||||||
var sigCh = make(chan os.Signal)
|
var sigCh = make(chan os.Signal, 1)
|
||||||
signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM)
|
signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM)
|
||||||
<-sigCh
|
<-sigCh
|
||||||
close(sigCh)
|
close(sigCh)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user