Skip to content

Commit 64cf848

Browse files
committed
fix bug in file closure
1 parent 9d4c645 commit 64cf848

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cmd/cloudexec/push.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,17 @@ func UploadDirectoryToSpaces(config config.Config, bucket string, sourcePath str
8080
return err
8181
}
8282

83-
// Explicitly close the file once we're done to prevent a "too many open files" error
84-
err = file.Close()
83+
// Write this file to the zipped archive
84+
_, err = io.Copy(zipFileEntry, file)
8585
if err != nil {
8686
return err
8787
}
8888

89-
// Write this file to the zipped archive
90-
_, err = io.Copy(zipFileEntry, file)
89+
// Explicitly close the file once we're done to prevent a "too many open files" error
90+
err = file.Close()
9191
if err != nil {
9292
return err
9393
}
94-
file.Close()
9594

9695
return nil
9796
})

0 commit comments

Comments
 (0)