Skip to content

Commit

Permalink
scan stdin by byte instead of line
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo Genzmer committed Jan 21, 2020
1 parent a5cff80 commit 24f8f91
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tee.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ package main
import (
"bufio"
"bytes"
"fmt"
"io"

"github.com/mattn/go-colorable"
"io"
)

func tee(stdin io.Reader, stdout io.Writer) string {
Expand All @@ -15,8 +13,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 24f8f91

Please sign in to comment.