Commit a65f861b authored by Alex Brainman's avatar Alex Brainman

os: use small buffer when reading from windows console

Fixes #5481.

R=golang-dev, dominik.honnef, bradfitz
CC=golang-dev
https://golang.org/cl/9437044
parent 78f5b616
...@@ -251,8 +251,14 @@ func (f *File) readConsole(b []byte) (n int, err error) { ...@@ -251,8 +251,14 @@ func (f *File) readConsole(b []byte) (n int, err error) {
return 0, nil return 0, nil
} }
if len(f.readbuf) == 0 { if len(f.readbuf) == 0 {
// syscall.ReadConsole seems to fail, if given large buffer.
// So limit the buffer to 16000 characters.
readN := 16000
if len(b) < readN {
readN = len(b)
}
// get more input data from os // get more input data from os
wchars := make([]uint16, len(b)) wchars := make([]uint16, readN)
var p *uint16 var p *uint16
if len(b) > 0 { if len(b) > 0 {
p = &wchars[0] p = &wchars[0]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment