aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata/recover.go
diff options
context:
space:
mode:
Diffstat (limited to 'testdata/recover.go')
-rw-r--r--testdata/recover.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/testdata/recover.go b/testdata/recover.go
index 260bf91bd..6fdf282e7 100644
--- a/testdata/recover.go
+++ b/testdata/recover.go
@@ -2,9 +2,11 @@ package main
import (
"runtime"
- "time"
+ "sync"
)
+var wg sync.WaitGroup
+
func main() {
println("# simple recover")
recoverSimple()
@@ -113,14 +115,16 @@ func deferPanic() {
}
func runtimeGoexit() {
+ wg.Add(1)
go func() {
defer func() {
println("Goexit deferred function, recover is nil:", recover() == nil)
+ wg.Done()
}()
runtime.Goexit()
}()
- time.Sleep(time.Millisecond)
+ wg.Wait()
}
func printitf(msg string, itf interface{}) {