From 88c405e02585e590cdb2405f8431cfb69482a507 Mon Sep 17 00:00:00 2001 From: Djordje Lukic Date: Thu, 13 Aug 2020 10:34:42 +0200 Subject: [PATCH] Use buffered channels for signals --- cli/main.go | 2 +- cli/mobycli/exec.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/main.go b/cli/main.go index e7fc8a28a..26c25315b 100644 --- a/cli/main.go +++ b/cli/main.go @@ -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 diff --git a/cli/mobycli/exec.go b/cli/mobycli/exec.go index 88c777d0e..fcf5a0625 100644 --- a/cli/mobycli/exec.go +++ b/cli/mobycli/exec.go @@ -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() {