From cbbc0ca7f5a3141e55fe3a1b97ed94f1a0a52503 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Mon, 25 Jul 2022 15:28:00 -0700 Subject: [PATCH] Keep deferred close as multiple calls are allowed --- internal/cli/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/cli/main.go b/internal/cli/main.go index c3b3d31d8..8e0a64d10 100644 --- a/internal/cli/main.go +++ b/internal/cli/main.go @@ -88,6 +88,7 @@ func Main(args []string) int { if err != nil { panic(err) } + defer base.Close() // Build the CLI cli := &cli.CLI{ @@ -110,11 +111,10 @@ func Main(args []string) int { panic(err) } + // Close the base here manually so we can detect if an + // error was encountered and modify the exit code if so err = base.Close() if err != nil { - log.Error("failure encountered while closing command", - "error", err, - ) exitCode = -1 }