Open Hades32 opened 5 years ago
CC @hanwen @FiloSottile
I got the same issue.
Do you use third-party terminal application? If you use mintty, an application which use Windows Console APIs does not work. you must use winpty to run the application.
We are facing the same issue but found out something slightly odd. First, we use the new golang.org/x/term
package rather than x/crypto/ssh/terminal
as mentioned in the title of this issue.
We face the same issue as described in this issue in Git Bash. The code is here: https://github.com/Scalingo/cli/blob/master/term/password.go#L13
But if we run Git Bash from within the terminal tab of VS Code, we no longer face the same issue, everything works as expected.
Does anyone know what is the difference between Git Bash and Git Bash inside VS Code?
I can't reproduce this. Windows 11 21H2 64Bit amd64.
I uploaded the smallest example which reproduces the issue here: https://github.com/EtienneM/mwe_read_password/blob/master/main.go
I'm not exactly sure about what information may be needed. My OS version:
C:\Users\Administrator>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoft Windows Server 2019 Datacenter
OS Version: 10.0.17763 N/A Build 17763
The Go version:
C:\Users\Administrator>go version
go version go1.19.2 windows/amd64
The golang.org/x/term
version is:
$ cat go.mod | grep "golang.org/x/term"
require golang.org/x/term v0.0.0-20220919170432-7a66f970e087
With this example, in Git Bash in VS Code I can type a password and the output is:
$ go build && ./mwe.exe
<nil>
In Git Bash outside of VS Code, I can't type the password and immediately get the error:
$ go build && ./mwe.exe
The handle is invalid.
I hit this problem as well. Run on mingw64 shell - If I run on windows cmd then it works. It is both on window 8 and windows 10 at my work place.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
no echo of password
What did you see instead?
"The handle is invalid."