Skip to content

x/crypto/ssh/terminal: GetSize doesn't work on Windows? #20388

@gbraad

Description

@gbraad

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:

	fd := int(os.Stdin.Fd())

	termWidth, termHeight, err := terminal.GetSize(fd)
	if err != nil {
		return "", err
	}

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 and powershell with an "invalid handle" error.

It seems that "golang.org/x/crypto/ssh/terminal" can not succesfully perform the following function:

func GetSize(fd int) (width, height int, err error)

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-archive-public/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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions