mirror of
https://github.com/golang/go
synced 2024-11-13 19:30:22 -07:00
os: read only 10,000 bytes at a time from Windows console
Reading 32,767 is too many on some versions of Windows. The exact upper bound is unclear. For #13697, but may not fix the problem on all systems. Change-Id: I197021ed60cbcd33c91ca6ceed456ec3d5a6c9d6 Reviewed-on: https://go-review.googlesource.com/18433 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
5ccaf0255b
commit
29eea94abe
@ -265,8 +265,10 @@ func (f *File) readConsole(b []byte) (n int, err error) {
|
|||||||
if len(f.readbuf) == 0 {
|
if len(f.readbuf) == 0 {
|
||||||
numBytes := len(b)
|
numBytes := len(b)
|
||||||
// Windows can't read bytes over max of int16.
|
// Windows can't read bytes over max of int16.
|
||||||
if numBytes > 32767 {
|
// Some versions of Windows can read even less.
|
||||||
numBytes = 32767
|
// See golang.org/issue/13697.
|
||||||
|
if numBytes > 10000 {
|
||||||
|
numBytes = 10000
|
||||||
}
|
}
|
||||||
mbytes := make([]byte, numBytes)
|
mbytes := make([]byte, numBytes)
|
||||||
var nmb uint32
|
var nmb uint32
|
||||||
|
Loading…
Reference in New Issue
Block a user