From 3292b5eb68fbbac121bac5791e924b9bcc3890e2 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Mon, 24 Aug 2020 08:56:21 -0400 Subject: [PATCH] Do not unlink file while it is still open - inside RunJob() there is a deferred function which will remove the entire temporary directory in which images are created, including the streamOptimized file - inside testBootUsingVMware(), which wants to use this function, there is already a deferred function which removes the converted image --- internal/upload/vmware/vmware.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/internal/upload/vmware/vmware.go b/internal/upload/vmware/vmware.go index a1b93a8e6..63ff518d5 100644 --- a/internal/upload/vmware/vmware.go +++ b/internal/upload/vmware/vmware.go @@ -18,9 +18,5 @@ func OpenAsStreamOptimizedVmdk(imagePath string) (*os.File, error) { if err != nil { return nil, err } - err = os.Remove(newPath) - if err != nil { - return nil, err - } return f, err }