Skip to content

Commit c36c789

Browse files
committed
chore(vipe): Ensure tmp file is always closed and removed
This is probably redundant, but it's better to close/remove the tmp file twice than not at all.
1 parent af26166 commit c36c789

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmd/vipe/vipe.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ func run(cmd *cobra.Command, _ []string) error {
7272
if err != nil {
7373
return err
7474
}
75+
defer func() {
76+
_ = tmp.Close()
77+
_ = os.Remove(tmp.Name())
78+
}()
7579

7680
if _, err := io.Copy(cmd.OutOrStdout(), tmp); err != nil {
7781
return err

0 commit comments

Comments
 (0)