Skip to content

Commit d5e838d

Browse files
committed
Filter: preserve previous error if func succeeds
1 parent 828fe5f commit d5e838d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

script.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,9 @@ func (p *Pipe) Filter(filter func(io.Reader, io.Writer) error) *Pipe {
480480
go func() {
481481
defer pw.Close()
482482
err := filter(origReader, pw)
483-
p.SetError(err)
483+
if err != nil {
484+
p.SetError(err)
485+
}
484486
}()
485487
return p
486488
}

0 commit comments

Comments
 (0)