1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-23 08:16:36 +00:00

Error message in case PasswordFile is missing

This commit is contained in:
donat 2017-07-27 14:23:08 +03:00
parent 61b8729ef9
commit 893bc9f777

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")
}