fs: Fix interaction between --progress and --interactive

Before this change if both --progress and --interactive were set then
the screen display could become muddled.

This change makes --progress and --interactive use the same lock so
while rclone is asking for interactive questions, the progress will be
paused.

Fixes #6755
This commit is contained in:
Nick Craig-Wood
2023-03-22 16:18:41 +00:00
parent cdfa0beafb
commit e042d9089f
3 changed files with 22 additions and 12 deletions
+3 -4
View File
@@ -75,14 +75,13 @@ func startProgress() func() {
// state for the progress printing
var (
nlines = 0 // number of lines in the previous stats block
progressMu sync.Mutex
nlines = 0 // number of lines in the previous stats block
)
// printProgress prints the progress with an optional log
func printProgress(logMessage string) {
progressMu.Lock()
defer progressMu.Unlock()
operations.StdoutMutex.Lock()
defer operations.StdoutMutex.Unlock()
var buf bytes.Buffer
w, _ := terminal.GetSize()