diff --git a/sdk/testutil/testlog.go b/sdk/testutil/testlog.go index e71e416ba..eaac152ec 100644 --- a/sdk/testutil/testlog.go +++ b/sdk/testutil/testlog.go @@ -38,6 +38,19 @@ func (tw *testWriter) Write(p []byte) (n int, err error) { if sendTestLogsToStdout || tw.t == nil { fmt.Fprint(os.Stdout, strings.TrimSpace(string(p))+"\n") } else { + defer func() { + if r := recover(); r != nil { + if sr, ok := r.(string); ok { + if strings.HasPrefix(sr, "Log in goroutine after ") { + // These sorts of panics are undesirable, but requires + // total control over goroutine lifetimes to correct. + fmt.Fprint(os.Stdout, "SUPPRESSED PANIC: "+sr+"\n") + return + } + } + panic(r) + } + }() tw.t.Log(strings.TrimSpace(string(p))) } return len(p), nil