diff options
author | Ian Lance Taylor <iant@golang.org> | 2023-03-16 12:14:03 -0700 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-03-16 19:34:54 +0000 |
commit | 4f5859c0467a6e252e4705cd0086aaef6904e5a4 (patch) | |
tree | 91f8d5eba8516106cab648ace4725f6c4882ed0e /src/os | |
parent | 964985362b4d8702a16bce08c7a825488ccb9601 (diff) | |
download | go-git-4f5859c0467a6e252e4705cd0086aaef6904e5a4.tar.gz |
os: don't check for TTY before calling splice
I think I confused myself in CL 476335. The TTY check did fix the
problem with os.Stdout, but it was still possible to get the same
problem in other ways. I fixed that by making the splice call blocking,
but it turns out that doing that is enough to fix the TTY problem also.
So we can just remove the TTY check.
Fixes #59041
Change-Id: I4d7ca9dad8361001edb4cfa96bb29b1badb54df0
Reviewed-on: https://go-review.googlesource.com/c/go/+/477035
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/readfrom_linux.go | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/os/readfrom_linux.go b/src/os/readfrom_linux.go index c67407cf66..7e8024028e 100644 --- a/src/os/readfrom_linux.go +++ b/src/os/readfrom_linux.go @@ -33,19 +33,6 @@ func (f *File) readFrom(r io.Reader) (written int64, handled bool, err error) { } func (f *File) spliceToFile(r io.Reader) (written int64, handled bool, err error) { - // At least as of kernel 5.19.11, splice to a tty fails. - // poll.Splice will do the wrong thing if it can splice from r - // but can't splice to f: it will read data from r, which is - // not what we want if r is a pipe or socket. - // So we have to check now whether f is a tty. - fi, err := f.Stat() - if err != nil { - return 0, false, err - } - if fi.Mode()&ModeCharDevice != 0 { - return 0, false, nil - } - var ( remain int64 lr *io.LimitedReader |