1
1
Fork 0
mirror of https://github.com/goreleaser/nfpm synced 2024-06-10 10:26:15 +02:00

chore: Cleanup temp files in RPM.Package() (#53)

RPM.Package() populates a temp directory with files to do its work. It should cleanup after itself.
This commit is contained in:
Aaron Beitch 2019-05-20 05:40:43 -07:00 committed by Carlos Alexandro Becker
parent 21aa860653
commit ce9ed27f16

View File

@ -54,6 +54,7 @@ func (*RPM) Package(info nfpm.Info, w io.Writer) error {
if err != nil {
return err
}
defer os.RemoveAll(temps.Root)
if err = createTarGz(info, temps.Folder, temps.Source); err != nil {
return err
}
@ -84,6 +85,7 @@ func (*RPM) Package(info nfpm.Info, w io.Writer) error {
if err != nil {
return errors.Wrap(err, "failed open rpm file")
}
defer rpm.Close()
_, err = io.Copy(w, rpm)
return errors.Wrap(err, "failed to copy rpm file to writer")
}