Fix reading passwords on windows
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-08-13 17:59:10 +02:00
parent 16dbcfda7e
commit bdfb804bb2
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 2 additions and 3 deletions

View File

@ -28,7 +28,6 @@ import (
"os"
"strconv"
"strings"
"syscall"
"time"
)
@ -72,12 +71,12 @@ func getPasswordFromFlagOrInput() (pw string) {
pw = userFlagPassword
if userFlagPassword == "" {
fmt.Print("Enter Password: ")
bytePW, err := terminal.ReadPassword(syscall.Stdin)
bytePW, err := terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
log.Fatalf("Error reading password: %s", err)
}
fmt.Printf("\nConfirm Password: ")
byteConfirmPW, err := terminal.ReadPassword(syscall.Stdin)
byteConfirmPW, err := terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
log.Fatalf("Error reading password: %s", err)
}