Add crash handler bypass for testing.

pull/6/head
Daniel Smith 2014-06-28 17:52:08 -07:00
parent 0760e9bc2c
commit 011ce9d871
2 changed files with 8 additions and 0 deletions

View File

@ -38,6 +38,7 @@ import (
func main() {
runtime.GOMAXPROCS(4)
util.ReallyCrash = true
util.InitLogs()
defer util.FlushLogs()

View File

@ -25,8 +25,15 @@ import (
"github.com/golang/glog"
)
// For testing, bypass HandleCrash.
var ReallyCrash bool
// Simply catches a crash and logs an error. Meant to be called via defer.
func HandleCrash() {
if ReallyCrash {
return
}
r := recover()
if r != nil {
callers := ""