Skip to content

Commit 45920de

Browse files
authored
Fix spinner not showing "✔ " when complete (#1098)
1 parent 0e6e8b1 commit 45920de

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

ext/TerminalSpinners.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,15 @@ function start!(s::Spinner)
128128
return s
129129
end
130130

131-
function stop!(s::Spinner)
131+
function close_timer!(s::Spinner)
132132
if s.timer !== nothing
133133
close(s.timer)
134+
s.timer = nothing
134135
end
136+
end
137+
138+
function stop!(s::Spinner)
139+
close_timer!(s)
135140
if !s.enabled || s.silent
136141
return
137142
end
@@ -140,12 +145,16 @@ function stop!(s::Spinner)
140145
end
141146

142147
function success!(s)
148+
# Stop the timer before the final render so a pending tick can't
149+
# overwrite the ✔ line with a spinner frame.
150+
close_timer!(s)
143151
if s.enabled && !s.silent
144152
render(s, "", :light_green)
145153
end
146154
stop!(s)
147155
end
148156
function fail!(s)
157+
close_timer!(s)
149158
if s.enabled && !s.silent
150159
render(s, "", :light_red)
151160
end

0 commit comments

Comments
 (0)