Use buffered channels for signals

This commit is contained in:
Djordje Lukic 2020-08-13 10:34:42 +02:00
parent 9a29037e0f
commit 88c405e025
2 changed files with 2 additions and 2 deletions

View File

@ -226,7 +226,7 @@ func checkIfUnknownCommandExistInDefaultContext(err error, currentContext string
func newSigContext() (context.Context, func()) {
ctx, cancel := context.WithCancel(context.Background())
s := make(chan os.Signal)
s := make(chan os.Signal, 1)
signal.Notify(s, syscall.SIGTERM, syscall.SIGINT)
go func() {
<-s

View File

@ -62,7 +62,7 @@ func Exec() {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
signals := make(chan os.Signal)
signals := make(chan os.Signal, 1)
childExit := make(chan bool)
signal.Notify(signals) // catch all signals
go func() {