From 3a9c1d106f9abcd07d3b2e1ccc5b1a2bf1667d37 Mon Sep 17 00:00:00 2001 From: Martin Puppe Date: Wed, 25 Mar 2020 18:47:35 +0100 Subject: [PATCH] Read password without trailing \n (newline) --- mpbackup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpbackup b/mpbackup index 97cddf2..967ed67 100644 --- a/mpbackup +++ b/mpbackup @@ -39,7 +39,7 @@ def do_backup(config) puts "Repository: #{ENV['RESTIC_REPOSITORY']}" if config['password-file'] puts "Reading password from file #{config['password-file']} …" - ENV['RESTIC_PASSWORD'] = File.open(config['password-file']) {|f| f.readline} + ENV['RESTIC_PASSWORD'] = File.open(config['password-file'], &:gets).chomp else ENV['RESTIC_PASSWORD'] = STDIN.getpass('Please put in your restic password: ') end