Skip to content

Commit e26be3c

Browse files
authored
fix: use os.Stdin.Fd instead of syscall.Stdin (#1256)
relates to STACKITCLI-315
1 parent c6c3ee2 commit e26be3c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

internal/pkg/print/print.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ import (
66
"encoding/json"
77
"errors"
88
"fmt"
9-
"syscall"
10-
11-
"github.com/goccy/go-yaml"
12-
139
"log/slog"
1410
"os"
1511
"os/exec"
1612
"strings"
1713

14+
"github.com/goccy/go-yaml"
15+
1816
"github.com/fatih/color"
1917
"github.com/lmittmann/tint"
2018
"github.com/mattn/go-colorable"
@@ -182,13 +180,16 @@ func (p *Printer) PromptForEnter(prompt string) error {
182180
func (p *Printer) PromptForPassword(prompt string) (string, error) {
183181
p.Cmd.PrintErr(prompt)
184182
defer p.Outputln("")
185-
if term.IsTerminal(syscall.Stdin) {
186-
bytePassword, err := term.ReadPassword(syscall.Stdin)
183+
184+
fd := int(os.Stdin.Fd())
185+
if term.IsTerminal(fd) {
186+
bytePassword, err := term.ReadPassword(fd)
187187
if err != nil {
188188
return "", fmt.Errorf("read password: %w", err)
189189
}
190190
return string(bytePassword), nil
191191
}
192+
192193
// Fallback for non-terminal environments
193194
reader := bufio.NewReader(p.Cmd.InOrStdin())
194195
pw, err := reader.ReadString('\n')

0 commit comments

Comments
 (0)