use os.Stdin

This commit is contained in:
r_takaishi 2020-03-06 14:34:17 +09:00
parent 92c36eea8c
commit 7cdb2e89e4
1 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import (
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/terminal" "golang.org/x/crypto/ssh/terminal"
"log" "log"
"syscall" "os"
) )
func KeyboardInteractive() ssh.KeyboardInteractiveChallenge { func KeyboardInteractive() ssh.KeyboardInteractiveChallenge {
@ -20,7 +20,7 @@ func KeyboardInteractive() ssh.KeyboardInteractiveChallenge {
} }
answers := make([]string, len(questions)) answers := make([]string, len(questions))
for i := range questions { for i := range questions {
s, err := terminal.ReadPassword(syscall.Stdin) s, err := terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil { if err != nil {
return nil, err return nil, err
} }