2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-04 18:10:50 +00:00

Merge pull request #1139 from donat-b/pwfile-doesnt-exist

Error message in case PasswordFile is missing
This commit is contained in:
Alexander Neumann 2017-07-27 15:41:50 +02:00
commit efc5d0699a

View File

@ -206,6 +206,9 @@ func Exitf(exitcode int, format string, args ...interface{}) {
func resolvePassword(opts GlobalOptions, env string) (string, error) {
if opts.PasswordFile != "" {
s, err := ioutil.ReadFile(opts.PasswordFile)
if os.IsNotExist(err) {
return "", errors.Fatalf("%s does not exist", opts.PasswordFile)
}
return strings.TrimSpace(string(s)), errors.Wrap(err, "Readfile")
}