mirror of
https://github.com/golang/go
synced 2024-11-26 12:48:11 -07:00
os: clarify windows read console code
R=golang-dev, r CC=golang-dev https://golang.org/cl/9458043
This commit is contained in:
parent
c15ca825ad
commit
fad27ec5d4
@ -253,12 +253,12 @@ func (f *File) readConsole(b []byte) (n int, err error) {
|
|||||||
if len(f.readbuf) == 0 {
|
if len(f.readbuf) == 0 {
|
||||||
// syscall.ReadConsole seems to fail, if given large buffer.
|
// syscall.ReadConsole seems to fail, if given large buffer.
|
||||||
// So limit the buffer to 16000 characters.
|
// So limit the buffer to 16000 characters.
|
||||||
readN := 16000
|
numBytes := len(b)
|
||||||
if len(b) < readN {
|
if numBytes > 16000 {
|
||||||
readN = len(b)
|
numBytes = 16000
|
||||||
}
|
}
|
||||||
// get more input data from os
|
// get more input data from os
|
||||||
wchars := make([]uint16, readN)
|
wchars := make([]uint16, numBytes)
|
||||||
var p *uint16
|
var p *uint16
|
||||||
if len(b) > 0 {
|
if len(b) > 0 {
|
||||||
p = &wchars[0]
|
p = &wchars[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user