diff --git a/internal/pkg/print/print.go b/internal/pkg/print/print.go index 6754db285..5f9bc398f 100644 --- a/internal/pkg/print/print.go +++ b/internal/pkg/print/print.go @@ -6,15 +6,13 @@ import ( "encoding/json" "errors" "fmt" - "syscall" - - "github.com/goccy/go-yaml" - "log/slog" "os" "os/exec" "strings" + "github.com/goccy/go-yaml" + "github.com/fatih/color" "github.com/lmittmann/tint" "github.com/mattn/go-colorable" @@ -182,13 +180,16 @@ func (p *Printer) PromptForEnter(prompt string) error { func (p *Printer) PromptForPassword(prompt string) (string, error) { p.Cmd.PrintErr(prompt) defer p.Outputln("") - if term.IsTerminal(syscall.Stdin) { - bytePassword, err := term.ReadPassword(syscall.Stdin) + + fd := int(os.Stdin.Fd()) + if term.IsTerminal(fd) { + bytePassword, err := term.ReadPassword(fd) if err != nil { return "", fmt.Errorf("read password: %w", err) } return string(bytePassword), nil } + // Fallback for non-terminal environments reader := bufio.NewReader(p.Cmd.InOrStdin()) pw, err := reader.ReadString('\n')