diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f57279..22c3560 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/internal/cli/compress/command.go b/internal/cli/compress/command.go index f7a0ae2..a98e3a1 100644 --- a/internal/cli/compress/command.go +++ b/internal/cli/compress/command.go @@ -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 }