Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Update archiver.go
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt authored Dec 13, 2023
1 parent 85ad2b9 commit 9898b73
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ func openAndCopyFile(file File, w io.Writer) error {
return err
}
defer fileReader.Close()
// When file is in use and size is being written to, creating the compressed
// file will fail with "archive/tar: write too long." Using CopyN gracefully
// handles this.
_, err = io.CopyN(w, fileReader, file.Size())
if err != nil && err != io.EOF {
return err
Expand Down

0 comments on commit 9898b73

Please sign in to comment.