1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-26 01:37:12 +00:00

Merge pull request #771 from restic/fix-770

Return an error if password is not set for stdin
This commit is contained in:
Alexander Neumann 2017-02-03 16:47:00 +01:00
commit d0de1ed2e4

View file

@ -235,6 +235,10 @@ func readBackupFromStdin(opts BackupOptions, gopts GlobalOptions, args []string)
return errors.Fatalf("when reading from stdin, no additional files can be specified") return errors.Fatalf("when reading from stdin, no additional files can be specified")
} }
if gopts.password == "" && gopts.PasswordFile == "" {
return errors.Fatal("Unable to read password from stdin when data is to be read from stdin, use --password-file or $RESTIC_PASSWORD")
}
repo, err := OpenRepository(gopts) repo, err := OpenRepository(gopts)
if err != nil { if err != nil {
return err return err