From c882a92cd63def3817df6b5130c5c831e80f71f2 Mon Sep 17 00:00:00 2001
From: Michael Eischer <michael.eischer@fau.de>
Date: Fri, 1 May 2020 22:38:03 +0200
Subject: [PATCH] backup: Avoid race between password prompt and open
 repository message

`term.Print` sends the output via a channel to a goroutine which
actually prints the message. This may race with the password prompt
printed by `OpenRepository` resulting in a missing prompt.
---
 cmd/restic/cmd_backup.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go
index 7df9addcf..4debeb13b 100644
--- a/cmd/restic/cmd_backup.go
+++ b/cmd/restic/cmd_backup.go
@@ -415,7 +415,7 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
 	var t tomb.Tomb
 
 	if gopts.verbosity >= 2 && !gopts.JSON {
-		term.Print("open repository\n")
+		Verbosef("open repository\n")
 	}
 
 	repo, err := OpenRepository(gopts)