-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/crypto/ssh/terminal: GetSize doesn't work on Windows? #20388
Comments
I don't understand the bug report. The Windows code doesn't involve an ioctl. The Windows code is many years old at this point and in util_windows.go: func GetSize(fd int) (width, height int, err error) {
var info consoleScreenBufferInfo
_, _, e := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&info)), 0)
if e != 0 {
return 0, 0, error(e)
}
return int(info.size.x), int(info.size.y), nil
} What is /cc @alexbrainman |
Will debug The value I got for the fd was |
Looking at an example https://msdn.microsoft.com/en-us/library/windows/desktop/ms685118(v=vs.85).aspx - the example calls GetStdHandle(STD_OUTPUT_HANDLE) to get the handle. So, I suppose, you should use os.Stdout.Fd() instead. I am not sure if that is the intended behavior. Alex |
Works as expected with doing: fd := int(os.Stdout.Fd())
termWidth, termHeight, err := terminal.GetSize(fd) pushing a change to libmachine for this. Cheers |
What version of Go are you using (
go version
)?go1.7.5
What operating system and processor architecture are you using (
go env
)?Compared functionality between two platforms:
go on linux/amd64
go on windows/amd64
What did you do?
I am doing the following:
on Linux, which returns me the correct size of the terminal when using for instance bash. However, this same call will fail on Windows
cmd
andpowershell
with an "invalid handle" error.It seems that
"golang.org/x/crypto/ssh/terminal"
can not succesfully perform the following function:More information about this can be found at: minishift/minishift-centos-iso#95 (comment) and minishift/minishift-centos-iso#95 (comment). This seems to be an issue when using Red Hat's provided ssh server with the go native implementation: docker/machine#3937
What did you expect to see?
I expected the command to pass
What did you see instead?
At the moment it fails with an
invalid handle
.The text was updated successfully, but these errors were encountered: