aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2016-01-08 11:23:25 -0500
committerRuss Cox <rsc@golang.org>2016-01-08 16:52:37 +0000
commit29eea94abe3841d9569f6b8d110d92a54641c31b (patch)
tree8a5a3a1e43036023d8e91e1abf0c423093ef5a95 /src
parent5ccaf0255b75063a9c685009e77cee24e26a509e (diff)
downloadgo-29eea94abe3841d9569f6b8d110d92a54641c31b.tar.xz
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>
Diffstat (limited to 'src')
-rw-r--r--src/os/file_windows.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/os/file_windows.go b/src/os/file_windows.go
index 9b0458552c..aa8c05c4ff 100644
--- a/src/os/file_windows.go
+++ b/src/os/file_windows.go
@@ -265,8 +265,10 @@ func (f *File) readConsole(b []byte) (n int, err error) {
if len(f.readbuf) == 0 {
numBytes := len(b)
// Windows can't read bytes over max of int16.
- if numBytes > 32767 {
- numBytes = 32767
+ // Some versions of Windows can read even less.
+ // See golang.org/issue/13697.
+ if numBytes > 10000 {
+ numBytes = 10000
}
mbytes := make([]byte, numBytes)
var nmb uint32