Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write password prompts to stderr to avoid co-mingling stdout (#3781) #3782

Merged
merged 1 commit into from
Jan 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builtin/credential/github/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (h *CLIHandler) Auth(c *api.Client, m map[string]string) (*api.Secret, erro
// Override the output
stdout := h.testStdout
if stdout == nil {
stdout = os.Stdout
stdout = os.Stderr
}

var err error
Expand Down
4 changes: 2 additions & 2 deletions builtin/credential/ldap/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ func (h *CLIHandler) Auth(c *api.Client, m map[string]string) (*api.Secret, erro
}
password, ok := m["password"]
if !ok {
fmt.Printf("Password (will be hidden): ")
fmt.Fprintf(os.Stderr, "Password (will be hidden): ")
var err error
password, err = pwd.Read(os.Stdin)
fmt.Println()
fmt.Fprintf(os.Stderr, "\n")
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions builtin/credential/okta/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ func (h *CLIHandler) Auth(c *api.Client, m map[string]string) (*api.Secret, erro
}
password, ok := m["password"]
if !ok {
fmt.Printf("Password (will be hidden): ")
fmt.Fprintf(os.Stderr, "Password (will be hidden): ")
var err error
password, err = pwd.Read(os.Stdin)
fmt.Println()
fmt.Fprintf(os.Stderr, "\n")
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion builtin/credential/token/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (h *CLIHandler) Auth(c *api.Client, m map[string]string) (*api.Secret, erro
// Override the output
stdout := h.testStdout
if stdout == nil {
stdout = os.Stdout
stdout = os.Stderr
}

// No arguments given, read the token from user input
Expand Down
4 changes: 2 additions & 2 deletions builtin/credential/userpass/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ func (h *CLIHandler) Auth(c *api.Client, m map[string]string) (*api.Secret, erro
return nil, fmt.Errorf("'username' must be specified")
}
if data.Password == "" {
fmt.Printf("Password (will be hidden): ")
fmt.Fprintf(os.Stderr, "Password (will be hidden): ")
password, err := pwd.Read(os.Stdin)
fmt.Println()
fmt.Fprintf(os.Stderr, "\n")
if err != nil {
return nil, err
}
Expand Down