check frame.complete first
Vladimir Bauer
4 years ago
| 311 | 311 | if err != nil { |
| 312 | 312 | return err |
| 313 | 313 | } |
| 314 | if frame.abort { | |
| 315 | s.barShutdownQueue = append(s.barShutdownQueue, b) | |
| 316 | } else if frame.complete { | |
| 314 | if frame.complete { | |
| 317 | 315 | // shutdown at next flush |
| 318 | 316 | // this ensures no bar ends up with less than 100% rendered |
| 319 | 317 | defer func() { |
| 320 | 318 | s.barShutdownQueue = append(s.barShutdownQueue, b) |
| 321 | 319 | }() |
| 320 | } else if frame.abort { | |
| 321 | s.barShutdownQueue = append(s.barShutdownQueue, b) | |
| 322 | 322 | } |
| 323 | 323 | totalLines += frame.lines |
| 324 | 324 | bm[b] = frame |