From 0776e79e8e968559a5c2b6a248a3ef6305659434 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Mon, 6 Jul 2020 13:51:48 +0200 Subject: [PATCH] =?UTF-8?q?Exit=20without=20error=20message=20if=20user=20?= =?UTF-8?q?canceled=20command=20(typical=20scenario=20:=20ACI=20`logs=20?= =?UTF-8?q?=E2=80=94=20follow`=20and=20ctrl-C=20while=20querying=20ACI)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cli/main.go b/cli/main.go index 1475ac7c1..bc51557b3 100644 --- a/cli/main.go +++ b/cli/main.go @@ -173,6 +173,11 @@ func main() { ctx = store.WithContextStore(ctx, s) if err = root.ExecuteContext(ctx); err != nil { + //if user canceled request, simply exit without any error message + if errors.Is(ctx.Err(), context.Canceled) { + os.Exit(130) + } + // Context should always be handled by new CLI requiredCmd, _, _ := root.Find(os.Args[1:]) if requiredCmd != nil && isOwnCommand(requiredCmd) {