diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 8a6fa378f2..5c60cddf9b 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -253,6 +253,14 @@ runtime·main(void) main·main(); if(raceenabled) runtime·racefini(); + + // Make racy client program work: if panicking on + // another goroutine at the same time as main returns, + // let the other goroutine finish printing the panic trace. + // Once it does, it will exit. See issue 3934. + if(runtime·panicking) + runtime·park(nil, nil, "panicwait"); + runtime·exit(0); for(;;) *(int32*)runtime·main = 0;