user/pass prompts from ro-ssh-agent are printed to stderr

This commit is contained in:
Mahrud Sayrafi
2018-03-12 12:39:32 -07:00
committed by Kyle Isom
parent b1fdf6d637
commit c0b30b638a
2 changed files with 4 additions and 8 deletions
+2 -2
View File
@@ -44,7 +44,7 @@ func GetPass(prompt string) (passwd string, err error) {
brk := make(chan bool)
// Display the prompt.
fmt.Print(prompt)
fmt.Fprintf(os.Stderr, prompt)
// File descriptors for stdin, stdout, and stderr.
fd := []uintptr{os.Stdin.Fd(), os.Stdout.Fd(), os.Stderr.Fd()}
@@ -76,7 +76,7 @@ func GetPass(prompt string) (passwd string, err error) {
}
// Carraige return after the user input.
fmt.Println("")
fmt.Fprintln(os.Stderr, "")
return passwd, err
}
+2 -6
View File
@@ -86,11 +86,7 @@ func registerFlags() {
}
func readLine(prompt string) (line string, err error) {
// TODO: find a way to ask for username and password
// such that the prompt itself is not captured in the
// standard output. This way running `ro ... ssh-agent`
// will set the SSH_AUTH_PATH environment variable.
fmt.Printf(prompt)
fmt.Fprintf(os.Stderr, prompt)
rd := bufio.NewReader(os.Stdin)
line, err = rd.ReadString('\n')
if err != nil {
@@ -116,7 +112,7 @@ func getUserCredentials() {
}
if pswd == "" {
pswd, err = gopass.GetPass("Password:")
pswd, err = gopass.GetPass("Password: ")
processError("error", err)
}
}