Fix reading passwords on windows
This commit is contained in:
parent
16dbcfda7e
commit
bdfb804bb2
1 changed files with 2 additions and 3 deletions
|
@ -28,7 +28,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -72,12 +71,12 @@ func getPasswordFromFlagOrInput() (pw string) {
|
||||||
pw = userFlagPassword
|
pw = userFlagPassword
|
||||||
if userFlagPassword == "" {
|
if userFlagPassword == "" {
|
||||||
fmt.Print("Enter Password: ")
|
fmt.Print("Enter Password: ")
|
||||||
bytePW, err := terminal.ReadPassword(syscall.Stdin)
|
bytePW, err := terminal.ReadPassword(int(os.Stdin.Fd()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error reading password: %s", err)
|
log.Fatalf("Error reading password: %s", err)
|
||||||
}
|
}
|
||||||
fmt.Printf("\nConfirm Password: ")
|
fmt.Printf("\nConfirm Password: ")
|
||||||
byteConfirmPW, err := terminal.ReadPassword(syscall.Stdin)
|
byteConfirmPW, err := terminal.ReadPassword(int(os.Stdin.Fd()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error reading password: %s", err)
|
log.Fatalf("Error reading password: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue