2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-28 13:00:53 +00:00

Merge pull request #3716 from MichaelEischer/password-error-on-stderr

Print password error message on stderr
This commit is contained in:
rawtaz 2022-04-21 01:40:54 +02:00 committed by GitHub
commit 07a565e6f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {