Skip to content

Commit

Permalink
refactor: ignore already closed error (#1285)
Browse files Browse the repository at this point in the history
* 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 <caseypl@amazon.com>
  • Loading branch information
KnisterPeter and cplee committed Aug 7, 2022
1 parent 3387fd7 commit 92ddcda
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/container/docker_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bufio"
"bytes"
"context"
"errors"
"fmt"
"io"
"io/ioutil"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 92ddcda

Please sign in to comment.