secret: fix terminal prompt for windows
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
70c1e4fa36
commit
99cf7d0ae0
@ -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")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user