Skip to content

Commit 93f3568

Browse files
authored
optimize Pipe.Wait (#187)
use io.Copy with io.Discard instead of io.ReadAll to avoid allocating a buffer just to throw it away
1 parent b4160e2 commit 93f3568

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

script.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ func (p *Pipe) Tee(writers ...io.Writer) *Pipe {
849849
// useful for waiting until concurrent filters have completed (see
850850
// [Pipe.Filter]).
851851
func (p *Pipe) Wait() {
852-
_, err := io.ReadAll(p)
852+
_, err := io.Copy(io.Discard, p)
853853
if err != nil {
854854
p.SetError(err)
855855
}

0 commit comments

Comments
 (0)