mirror of https://github.com/k3s-io/k3s
Add crash handler bypass for testing.
parent
0760e9bc2c
commit
011ce9d871
|
@ -38,6 +38,7 @@ import (
|
|||
|
||||
func main() {
|
||||
runtime.GOMAXPROCS(4)
|
||||
util.ReallyCrash = true
|
||||
util.InitLogs()
|
||||
defer util.FlushLogs()
|
||||
|
||||
|
|
|
@ -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 := ""
|
||||
|
|
Loading…
Reference in New Issue