mirror of
https://github.com/peco/peco.git
synced 2026-09-10 07:16:29 -04:00
Log panics in SimScreen PollEvent instead of swallowing
This commit is contained in:
parent
51e6af6d36
commit
7bbd53e775
|
|
@ -6,6 +6,7 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -232,7 +233,11 @@ func (s *SimScreen) Flush() error {
|
|||
func (s *SimScreen) PollEvent(ctx context.Context, _ *Config) chan Event {
|
||||
evCh := make(chan Event)
|
||||
go func() {
|
||||
defer func() { recover() }()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
fmt.Fprintf(os.Stderr, "SimScreen: panic in PollEvent goroutine: %v\n%s", r, debug.Stack())
|
||||
}
|
||||
}()
|
||||
defer close(evCh)
|
||||
|
||||
for {
|
||||
|
|
|
|||
Loading…
Reference in a new issue