Skip to content

Commit

Permalink
Merge pull request #60 from timothegenzmer/fix-large-input
Browse files Browse the repository at this point in the history
scan stdin by byte instead of line
  • Loading branch information
dtan4 authored Mar 10, 2020
2 parents c0d0933 + 44c9603 commit f863e19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tee.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"bufio"
"bytes"
"fmt"
"io"

"github.com/mattn/go-colorable"
Expand All @@ -15,8 +14,9 @@ func tee(stdin io.Reader, stdout io.Writer) string {

tee := io.TeeReader(stdin, &b1)
s := bufio.NewScanner(tee)
s.Split(bufio.ScanBytes)
for s.Scan() {
fmt.Fprintln(stdout, s.Text())
stdout.Write(s.Bytes())
}

uncolorize := colorable.NewNonColorable(&b2)
Expand Down

0 comments on commit f863e19

Please sign in to comment.