Skip to content

Commit

Permalink
Fix: Tests hanging on MacOS when testing error on phase (#244)
Browse files Browse the repository at this point in the history
Signed-off-by: Javier Romero <jromero@pivotal.io>
  • Loading branch information
jromero committed Aug 6, 2019
1 parent d871331 commit 5952513
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ func readAsTar(src, basePath string, uid, gid int, mode int64, writeFn func(tw *
}()

tw := tar.NewWriter(w)
defer tw.Close()
defer func() {
// only close if no errors have occurred
if err == nil {
tw.Close()
}
}()

err = writeFn(tw, src, basePath, uid, gid, mode)
}()
Expand Down

0 comments on commit 5952513

Please sign in to comment.