Closed
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go1.11 windows/amd64
Does this issue reproduce with the latest release?
Yes (since as far as I know this is the latest release).
What operating system and processor architecture are you using (go env
)?
Windows 10, amd64.
What did you do?
package main
import (
"fmt"
"os"
"golang.org/x/crypto/ssh/terminal"
)
func main() {
termID := int(os.Stdout.Fd())
termWidth, termHeight, termSizeErr := terminal.GetSize(termID)
if termSizeErr != nil {
panic(termSizeErr)
}
fmt.Printf("Width: %v, height: %v", termWidth, termHeight)
}
What did you expect to see?
Accurate height and width of the terminal.
What did you see instead?
Height is way off. My terminal window is 30 lines tall, but this returns a height of 9001. Width was correct, however.
In addition, I noticed that this issue remains. On Windows, getting the terminal handle via os.Stdin.Fd()
results in an error, while os.Stdout.Fd()
results in the above. However, on Linux, using Stdin
works properly.