diff options
author | Bjørn Erik Pedersen <[email protected]> | 2016-11-04 00:44:49 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2016-11-04 00:44:49 +0100 |
commit | 0cd0adda20d29967664f73da1fa99bdfdf0a497f (patch) | |
tree | 9c694e65d19758c38eef5573e7f106c42b95c29b /transform | |
parent | 3a86aba517f9feab4e2359b7efe71fb126092be5 (diff) | |
download | hugo-0cd0adda20d29967664f73da1fa99bdfdf0a497f.tar.gz hugo-0cd0adda20d29967664f73da1fa99bdfdf0a497f.zip |
transform: Return any read or write error from Apply
Diffstat (limited to 'transform')
-rw-r--r-- | transform/chain.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/transform/chain.go b/transform/chain.go index 7be38ccaa..fbcf0eff2 100644 --- a/transform/chain.go +++ b/transform/chain.go @@ -69,10 +69,14 @@ func (c *chain) Apply(w io.Writer, r io.Reader, p []byte) error { b1 := bp.GetBuffer() defer bp.PutBuffer(b1) - b1.ReadFrom(r) + if _, err := b1.ReadFrom(r); err != nil { + return err + } if len(*c) == 0 { - b1.WriteTo(w) + if _, err := b1.WriteTo(w); err != nil { + return err + } return nil } @@ -97,6 +101,6 @@ func (c *chain) Apply(w io.Writer, r io.Reader, p []byte) error { tr(fb) } - fb.to.WriteTo(w) - return nil + _, err := fb.to.WriteTo(w) + return err } |