From 587b38d10c2a88ae4ad6ccf1e9a2ad33af1e3305 Mon Sep 17 00:00:00 2001 From: Mladen Jablanovic Date: Tue, 13 Jan 2026 11:58:41 +0100 Subject: [PATCH] fix(CLI): Stuck waiting when using push -w -B --- clients/cli/cmd/internal/print/print.go | 8 +++++++- clients/cli/cmd/internal/spinner/spinner.go | 14 +++++--------- clients/cli/go.sum | 4 ++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/clients/cli/cmd/internal/print/print.go b/clients/cli/cmd/internal/print/print.go index d2d961b38..15dbb7551 100644 --- a/clients/cli/cmd/internal/print/print.go +++ b/clients/cli/cmd/internal/print/print.go @@ -46,7 +46,13 @@ func PhraseLogo() { // Prints the argument if the command is started in non-batch mode func NonBatchPrintf(msg string, args ...interface{}) { if !shared.BatchMode { - fmt.Print(fmt.Sprintf(msg, args...)) + fmt.Printf(msg, args...) + } +} + +func NonBatchPrint(msg string) { + if !shared.BatchMode { + fmt.Print(msg) } } diff --git a/clients/cli/cmd/internal/spinner/spinner.go b/clients/cli/cmd/internal/spinner/spinner.go index 3aecbb9d2..e2092d652 100644 --- a/clients/cli/cmd/internal/spinner/spinner.go +++ b/clients/cli/cmd/internal/spinner/spinner.go @@ -1,10 +1,9 @@ package spinner import ( - "fmt" "time" - "github.com/phrase/phrase-cli/cmd/internal/shared" + "github.com/phrase/phrase-cli/cmd/internal/print" ) // While executes f, displays an animated spinner while f runs, and stops when f returns. @@ -33,18 +32,15 @@ func Until(c <-chan struct{}) { // spin animates a spinner until it receives something on the stop channel. It then clears the spinning character and closes the stop channel, signaling that it's done. func spin(stop chan struct{}) { - if shared.BatchMode { - return - } chars := []string{`-`, `\`, `|`, `/`} - fmt.Print(" ") + print.NonBatchPrint(" ") i := 0 for { - fmt.Print("\b") - fmt.Print(chars[i]) + print.NonBatchPrint("\b") + print.NonBatchPrint(chars[i]) select { case <-stop: - fmt.Print("\b ") + print.NonBatchPrint("\b ") close(stop) return case <-time.After(100 * time.Millisecond): diff --git a/clients/cli/go.sum b/clients/cli/go.sum index f41e9ed55..dfc1b5984 100644 --- a/clients/cli/go.sum +++ b/clients/cli/go.sum @@ -215,8 +215,8 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/phrase/phrase-go/v4 v4.9.0 h1:V+MWmNrxwrYNtmoY41dgrdWT902Er2hcohtQcpVvWmw= -github.com/phrase/phrase-go/v4 v4.9.0/go.mod h1:4XplKvrbHS2LDaXfFp9xrVDtO5xk2WHFm0htutwwd8c= +github.com/phrase/phrase-go/v4 v4.18.0 h1:LSD1izhuwF1TzxlLKdoItfyeSbCuiSs5RCmNiv8vmLg= +github.com/phrase/phrase-go/v4 v4.18.0/go.mod h1:4XplKvrbHS2LDaXfFp9xrVDtO5xk2WHFm0htutwwd8c= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=