Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 93f3568

Browse files
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)

AltStyle によって変換されたページ (->オリジナル) /