diff --git a/changelog/unreleased/pull-3716 b/changelog/unreleased/pull-3716 new file mode 100644 index 000000000..3b0e7471f --- /dev/null +++ b/changelog/unreleased/pull-3716 @@ -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 diff --git a/cmd/restic/global.go b/cmd/restic/global.go index 7b59ef4b6..f4a2df1b5 100644 --- a/cmd/restic/global.go +++ b/cmd/restic/global.go @@ -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 {