From 92ddcdae098873ad6d9c05748ce5b6c7be83b811 Mon Sep 17 00:00:00 2001 From: Markus Wolf Date: Sun, 7 Aug 2022 08:07:54 +0200 Subject: [PATCH] refactor: ignore already closed error (#1285) * refactor: ignore already closed error This hides the `file already cloesd` error as it is distracting in the output and does not provide any value. * refactor: use go errors Co-authored-by: Casey Lee --- pkg/container/docker_run.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/container/docker_run.go b/pkg/container/docker_run.go index faf11a8e..db46412d 100644 --- a/pkg/container/docker_run.go +++ b/pkg/container/docker_run.go @@ -5,6 +5,7 @@ import ( "bufio" "bytes" "context" + "errors" "fmt" "io" "io/ioutil" @@ -696,7 +697,7 @@ func (cr *containerReference) copyDir(dstPath string, srcPath string, useGitIgno defer func(tarFile *os.File) { name := tarFile.Name() err := tarFile.Close() - if err != nil { + if !errors.Is(err, os.ErrClosed) { logger.Error(err) } err = os.Remove(name)