Skip to content

Commit 178de37

Browse files
committed
feat: added explicit termination of progress indicator
1 parent 09bd3af commit 178de37

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/cmd/beta/image/create/create.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,15 @@ func uploadAsync(ctx context.Context, p *print.Printer, model *inputModel, file
173173
go func() {
174174
ticker := time.NewTicker(2 * time.Second)
175175
var uploaded int
176+
done:
176177
for {
177178
select {
178179
case <-ticker.C:
179180
p.Info("uploaded %3.1f%%\n", 100.0/float64(stat.Size())*float64(uploaded))
180-
case n := <-ch:
181+
case n,ok := <-ch:
182+
if !ok {
183+
break done
184+
}
181185
if n >= 0 {
182186
uploaded += n
183187
}

0 commit comments

Comments
 (0)