mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Add crash handler bypass for testing.
This commit is contained in:
parent
0760e9bc2c
commit
011ce9d871
@ -38,6 +38,7 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
runtime.GOMAXPROCS(4)
|
runtime.GOMAXPROCS(4)
|
||||||
|
util.ReallyCrash = true
|
||||||
util.InitLogs()
|
util.InitLogs()
|
||||||
defer util.FlushLogs()
|
defer util.FlushLogs()
|
||||||
|
|
||||||
|
@ -25,8 +25,15 @@ import (
|
|||||||
"github.com/golang/glog"
|
"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.
|
// Simply catches a crash and logs an error. Meant to be called via defer.
|
||||||
func HandleCrash() {
|
func HandleCrash() {
|
||||||
|
if ReallyCrash {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
r := recover()
|
r := recover()
|
||||||
if r != nil {
|
if r != nil {
|
||||||
callers := ""
|
callers := ""
|
||||||
|
Loading…
Reference in New Issue
Block a user