From 6b1fd647e102893094e55132d5f4f9a16e2ffea4 Mon Sep 17 00:00:00 2001 From: William Petit Date: Mon, 1 Aug 2022 17:13:56 +0200 Subject: [PATCH] fix: ignore ErrClosed in deferred func --- internal/command/common.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/command/common.go b/internal/command/common.go index 22d8479..a389709 100644 --- a/internal/command/common.go +++ b/internal/command/common.go @@ -4,6 +4,7 @@ import ( "bytes" "io" "net/url" + "os" encjson "encoding/json" @@ -173,7 +174,7 @@ func outputValues(ctx *cli.Context, values interface{}) error { } defer func() { - if err := writer.Close(); err != nil { + if err := writer.Close(); err != nil && !errors.Is(err, os.ErrClosed) { panic(errors.WithStack(err)) } }()