Verified Commit cddaf301 authored by Tomasz Maczukin's avatar Tomasz Maczukin
Browse files

Move k8s log handlers initialization to init()

parent 9e07b069
Pipeline #29376542 passed with stages
in 26 minutes and 47 seconds
......@@ -47,14 +47,6 @@ func (*DefaultRemoteExecutor) Execute(method string, url *url.URL, config *restc
return err
}
runtime.ErrorHandlers = append(runtime.ErrorHandlers, func(err error) {
logrus.WithError(err).Error("K8S stream error")
})
runtime.PanicHandlers = append(runtime.PanicHandlers, func(r interface{}) {
logrus.Errorf("K8S stream panic: %v", r)
})
return exec.Stream(remotecommand.StreamOptions{
Stdin: stdin,
Stdout: stdout,
......@@ -121,3 +113,13 @@ func (p *ExecOptions) Run() error {
return p.Executor.Execute("POST", req.URL(), p.Config, stdin, p.Out, p.Err, false)
}
func init() {
runtime.ErrorHandlers = append(runtime.ErrorHandlers, func(err error) {
logrus.WithError(err).Error("K8S stream error")
})
runtime.PanicHandlers = append(runtime.PanicHandlers, func(r interface{}) {
logrus.Errorf("K8S stream panic: %v", r)
})
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment