From a05c374db8b40cc9d1d04c50fbaf84c4b84d4f3d Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Wed, 14 Mar 2018 16:22:58 +0100 Subject: [PATCH] shared: Clean up tarball if tar fails Signed-off-by: Thomas Hipp --- shared/util.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared/util.go b/shared/util.go index ad6dc2f9..4cc9389f 100644 --- a/shared/util.go +++ b/shared/util.go @@ -143,6 +143,8 @@ func CreateGPGKeyring(keyserver string, keys []string) (string, error) { func Pack(filename, compression, path string, args ...string) error { err := RunCommand("tar", append([]string{"-cf", filename, "-C", path}, args...)...) if err != nil { + // Clean up incomplete tarball + os.Remove(filename) return err }