1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-22 15:57:07 +00:00

Print password error message on stderr

The password prompt itself is already printed on stderr.
This commit is contained in:
Michael Eischer 2022-04-20 20:03:21 +02:00
parent dba47d29d5
commit bf7da7ff10
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,7 @@
Bugfix: Print "wrong password" error on stderr
If a wrong password was entered, the error message was printed on stdout and
not on stderr as intended. This has been fixed.
https://github.com/restic/restic/pull/3716
https://forum.restic.net/t/should-error-messages-end-up-in-output-file-when-redirecting-dump-to-stdout/4965

View file

@ -455,7 +455,7 @@ func OpenRepository(opts GlobalOptions) (*repository.Repository, error) {
err = s.SearchKey(opts.ctx, opts.password, maxKeys, opts.KeyHint)
if err != nil && passwordTriesLeft > 1 {
opts.password = ""
fmt.Printf("%s. Try again\n", err)
fmt.Fprintf(os.Stderr, "%s. Try again\n", err)
}
}
if err != nil {