mirror of
https://github.com/restic/restic.git
synced 2025-01-31 19:51:26 +00:00
Merge pull request #1139 from donat-b/pwfile-doesnt-exist
Error message in case PasswordFile is missing
This commit is contained in:
commit
efc5d0699a
1 changed files with 3 additions and 0 deletions
|
@ -206,6 +206,9 @@ func Exitf(exitcode int, format string, args ...interface{}) {
|
||||||
func resolvePassword(opts GlobalOptions, env string) (string, error) {
|
func resolvePassword(opts GlobalOptions, env string) (string, error) {
|
||||||
if opts.PasswordFile != "" {
|
if opts.PasswordFile != "" {
|
||||||
s, err := ioutil.ReadFile(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")
|
return strings.TrimSpace(string(s)), errors.Wrap(err, "Readfile")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue