print password from stdin message only to terminal

This commit is contained in:
Michael Eischer 2025-02-07 20:54:18 +01:00
parent da47967316
commit 5497217018
1 changed files with 3 additions and 1 deletions

View File

@ -370,8 +370,10 @@ func ReadPassword(ctx context.Context, opts GlobalOptions, prompt string) (strin
password, err = readPasswordTerminal(ctx, os.Stdin, os.Stderr, prompt) password, err = readPasswordTerminal(ctx, os.Stdin, os.Stderr, prompt)
} else { } else {
password, err = readPassword(os.Stdin) password, err = readPassword(os.Stdin)
if stdoutIsTerminal() {
Verbosef("reading repository password from stdin\n") Verbosef("reading repository password from stdin\n")
} }
}
if err != nil { if err != nil {
return "", errors.Wrap(err, "unable to read password") return "", errors.Wrap(err, "unable to read password")