diff --git a/goemitter_test/main b/goemitter_test/main new file mode 100755 index 0000000..fbf4a6b Binary files /dev/null and b/goemitter_test/main differ diff --git a/goemitter_test/main.go b/goemitter_test/main.go index 1427630..98bd6c2 100644 --- a/goemitter_test/main.go +++ b/goemitter_test/main.go @@ -2,6 +2,9 @@ package main import ( "fmt" + "log" + "runtime/debug" + "time" emitter "git.pyer.club/kingecg/goemitter" ) @@ -30,5 +33,12 @@ func main() { }) em.EmitSync("test", "hello", "world") em.Emit("test", "hello", "world2") - select {} + defer func() { + if r := recover(); r != nil { + log.Println("Recovered in main:", r) + // 打印当前所有 goroutine 的堆栈信息 + log.Println(string(debug.Stack())) + } + }() + time.Sleep(1 * time.Second) }