From 9d1fb2f4e73c0bb7adf5df7aa1f81edf160e02c3 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 8 Aug 2019 15:19:41 +0100 Subject: [PATCH] Revert "cmd: shorten the locking window when using --progress to avoid deadlock" This reverts commit fdef567da603d26eb2b348e23a2636b9991c7188. The problem turned out to be elsewhere. --- cmd/progress.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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)