Skip to content

Commit 24c982d

Browse files
committed
Fix double cancel() call in RunSpinner when doneMsg is empty
- Call cancel() explicitly before clearing line when doneMsg is empty - Remove duplicate cancel() call that was causing double cancellation - Ensure spinner is stopped before clearing with ANSI escape codes - Defer cancel() remains safe as cancel() is idempotent
1 parent 9384a90 commit 24c982d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/ui/components.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ func RunSpinner(msg, doneMsg string, fn func() error) error {
120120
}
121121
// If doneMsg is empty, clear the spinner line instead of showing a message
122122
if doneMsg == "" {
123-
// Stop the spinner first (this will clear its output)
124-
// Then clear the line using ANSI escape code to ensure it's completely hidden
123+
// Stop the spinner first (cancel() is idempotent, so defer will be safe)
124+
cancel()
125+
// Clear the line using ANSI escape code to ensure it's completely hidden
125126
// \r moves to start of line, \033[2K clears the entire line
126127
// Add a newline so subsequent output appears on a fresh line
127-
cancel() // Stop the spinner
128128
fmt.Print("\r\033[2K\n")
129129
return nil
130130
}

0 commit comments

Comments
 (0)