Skip to content

Commit

Permalink
Write password prompts to stderr to avoid co-mingling stdout (#3781) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
samiam authored and jefferai committed Jan 18, 2018
1 parent 8bbece9 commit 4ddd1f2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
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

0 comments on commit 4ddd1f2

Please sign in to comment.