Skip to content

Commit

Permalink
Fix bug in CompressWithGzip
Browse files Browse the repository at this point in the history
Propagate io.Copy errors through the io.Pipe
  • Loading branch information
mihaitodor committed Oct 5, 2018
1 parent 1e0a10a commit 11cdf77
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ func CompressWithGzip(data io.Reader) (io.Reader, error) {
go func() {
_, err = io.Copy(gzipWriter, data)
gzipWriter.Close()
pipeWriter.Close()
// subsequent reads from the read half of the pipe will
// return no bytes and the error err, or EOF if err is nil.
pipeWriter.CloseWithError(err)
}()

return pipeReader, err
Expand Down

0 comments on commit 11cdf77

Please sign in to comment.