Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

Revert "cmd: shorten the locking window when using --progress to avoid deadlock"

Nick Craig-Wood9d1fb2f4e73c
diff --git a/cmd/progress.go b/cmd/progress.go
index 8c09cee89..0ea44501a 100644
--- a/cmd/progress.go
+++ b/cmd/progress.go
@@ -84,6 +84,9 @@ var (
// printProgress prints the progress with an optional log
func printProgress(logMessage string) {
+ progressMu.Lock()
+ defer progressMu.Unlock()
+
var buf bytes.Buffer
w, h, err := terminal.GetSize(int(os.Stdout.Fd()))
if err != nil {
@@ -97,10 +100,6 @@ func printProgress(logMessage string) {
buf.WriteString(s)
}
- // Lock from here to prevent terminal corruption
- progressMu.Lock()
- progressMu.Unlock()
-
if logMessage != "" {
out("\n")
out(moveUp)