Skip to content

Commit

Permalink
Fix original file copy closing
Browse files Browse the repository at this point in the history
  • Loading branch information
tarampampam committed Nov 8, 2022
1 parent 5fd7fe8 commit 5d6b5ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].

## v4.0.1

### Fixed

- Original file copy closing

## v4.0.0

### Changed
Expand Down
2 changes: 2 additions & 0 deletions internal/cli/compress/command.go
Expand Up @@ -493,6 +493,8 @@ func (*command) Replace(origFilePath, tmpFilePath string, keepOriginalFileModTim
return origCopyFileErr
}

defer func() { _ = origCopyFile.Close() }()

if _, err := io.Copy(origCopyFile, origFile); err != nil {
return err
}
Expand Down

0 comments on commit 5d6b5ab

Please sign in to comment.