From 807fcf07d94acca7eeb53dcfd11d35aa80a88917 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 3 Feb 2017 15:53:07 +0100 Subject: [PATCH] Return an error if password is not set for stdin Closes #770 --- src/cmds/restic/cmd_backup.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cmds/restic/cmd_backup.go b/src/cmds/restic/cmd_backup.go index c8e3933eb..89a0f850c 100644 --- a/src/cmds/restic/cmd_backup.go +++ b/src/cmds/restic/cmd_backup.go @@ -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") } + 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) if err != nil { return err