-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version)?
go version devel +5af7553 Wed Nov 9 00:21:04 2016 +0000 windows/amd64
What operating system and processor architecture are you using (go env)?
Windows 7 64bit
What did you do?
package main
import (
"fmt"
"os"
)
func main() {
p := make([]byte, 100)
fmt.Printf("> ")
for {
n, err := os.Stdin.Read(p)
fmt.Printf("[%d %q %v]\n> ", n, p[:n], err)
}
}go run and type hello\n on the prompt >.
What did you expect to see?
output [7 "hello\r\n" <nil>]
What did you see instead?
[1 "h" <nil>]
[1 "e" <nil>]
[1 "l" <nil>]
[1 "l" <nil>]
[1 "o" <nil>]
[1 "\r" <nil>]
[1 "\n" <nil>]
When 100 bytes buffer is given, readConsole should be filled with hello\r\n on console. Because GetConsoleMode() is ENABLE_LINE_INPUT and if call ReadFile with enough buffer, it fill as hello\r\n.
https://go-review.googlesource.com/#/c/31114/ will fix this.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.