flushFrame writes the queued output and the current frame, and reports whether a frame was drawn. If the renderer panics, ok is false and the panic is recovered so the terminal still gets restored. The recovery runs on another goroutine: shutting down sends on rendererDone, which only the renderer g
()
| 1659 | // another goroutine: shutting down sends on rendererDone, which only the |
| 1660 | // renderer goroutine calling flushFrame receives. |
| 1661 | func (p *Program) flushFrame() (drew, ok bool) { |
| 1662 | if !p.disableCatchPanics { |
| 1663 | defer func() { |
| 1664 | if r := recover(); r != nil { |
| 1665 | ok = false |
| 1666 | go p.recoverFromGoPanicWithStack(r, debug.Stack()) |
| 1667 | } |
| 1668 | }() |
| 1669 | } |
| 1670 | p.keepWriteErr(p.flush()) |
| 1671 | drew, err := p.renderer.flush(false) |
| 1672 | p.keepWriteErr(err) |
| 1673 | return drew, true |
| 1674 | } |
| 1675 | |
| 1676 | // stopRenderer stops the renderer. |
| 1677 | // If kill is true, the renderer will be stopped immediately without flushing |
no test coverage detected