mirror of
https://github.com/cloudflare/redoctober.git
synced 2026-08-15 11:46:16 +00:00
user/pass prompts from ro-ssh-agent are printed to stderr
This commit is contained in:
committed by
Kyle Isom
parent
b1fdf6d637
commit
c0b30b638a
@@ -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
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user