secret: fix terminal prompt for windows

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-05-27 14:08:49 -07:00
parent 70c1e4fa36
commit 99cf7d0ae0

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")
} }