Merge pull request #515 from aluzzardi/secret-term-fix-windows

secret: fix terminal prompt for windows
This commit is contained in:
Andrea Luzzardi 2021-05-27 14:28:22 -07:00 committed by GitHub
commit 65da2f1c59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@ package input
import ( import (
"fmt" "fmt"
"syscall" "os"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
@ -30,7 +30,7 @@ var secretCmd = &cobra.Command{
if len(args) == 1 { if len(args) == 1 {
// No value specified: prompt terminal // No value specified: prompt terminal
fmt.Print("Secret: ") fmt.Print("Secret: ")
data, err := term.ReadPassword(syscall.Stdin) data, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil { if err != nil {
lg.Fatal().Err(err).Msg("unable to read secret from terminal") lg.Fatal().Err(err).Msg("unable to read secret from terminal")
} }