Skip to content

Commit

Permalink
fix: Redirect passphrase output to Standard error (#343)
Browse files Browse the repository at this point in the history
redirect passpharse output to Standard error

Signed-off-by: Andrés Torres <andrest@vmware.com>

Co-authored-by: Joshua Lock <jlock@vmware.com>
  • Loading branch information
elfotografo007 and joshuagl committed Jul 15, 2022
1 parent 9020b3c commit 9334b3f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/tuf/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ func getPassphrase(role string, confirm bool, change bool) ([]byte, error) {
// No environment variable set, so proceed prompting for new passphrase
role = fmt.Sprintf("new %s", role)
}
fmt.Printf("Enter %s keys passphrase: ", role)
fmt.Fprintf(os.Stderr, "Enter %s keys passphrase: ", role)
passphrase, err := term.ReadPassword(int(syscall.Stdin))
fmt.Println()
fmt.Fprintln(os.Stderr)
if err != nil {
return nil, err
}
Expand All @@ -156,9 +156,9 @@ func getPassphrase(role string, confirm bool, change bool) ([]byte, error) {
return passphrase, nil
}

fmt.Printf("Repeat %s keys passphrase: ", role)
fmt.Fprintf(os.Stderr, "Repeat %s keys passphrase: ", role)
confirmation, err := term.ReadPassword(int(syscall.Stdin))
fmt.Println()
fmt.Fprintln(os.Stderr)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 9334b3f

Please sign in to comment.