You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ianlancetaylor
changed the title
x/tools/crypto/ssh/terminal: ReadPassword broken on windows
x/crypto/ssh/terminal: ReadPassword broken on windows
Jul 29, 2015
You're correct, I made the mistake of assuming that syscall.Stdin was 0 on windows. I never considered that it would be different on windows (silly windows), and the docs on stdin were a little misleading. Thank you for the clarification!
There are actually two reason this might be caused.
The first is documented above and correct that the handle ids on Windows are not the same as Unix.
But the second reason is…. if you are using Cygwin/mintty/git-bash on Windows, those Windows shells are unable to reach down to the OS API, and will throw the exact same error of the “handle is invalid”.
This issue is not directly fixable and really not an issue with Go. If you switch to Powershell or even CMD then executing ReadPassword will work as expected. You may then switch back to your shell for all other commands that don’t invoke ReadPassword. If you must stay in Cygwin/minty/git-bash then take a look at https://github.com/rprichard/winpty project, it might solve your issue.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
On
go1.4.2 windows/amd64
withgolang.org/x/crypto/ssh/terminal
revision56474dfd625f18739b46f075b138fd0133717491
.ReadPassword seems to be broken.
Reproduction Case:
When I run this code on Windows 10,
ReadPassword()
throws the following error:The handle is invalid.
The same code works on
linux
andosx
.The text was updated successfully, but these errors were encountered: