Skip to content

Commit

Permalink
Check error return from adding shutdown function
Browse files Browse the repository at this point in the history
  • Loading branch information
bboreham committed May 18, 2021
1 parent 673c8e2 commit 7eff97a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,13 @@ func main() {
// +kubebuilder:scaffold:builder

// Close capture file when program shuts down
mgr.Add(manager.RunnableFunc(func(stop <-chan struct{}) error {
if err := mgr.Add(manager.RunnableFunc(func(stop <-chan struct{}) error {
<-stop
return capture.Close()
}))
})); err != nil {
setupLog.Error(err, "unable to add close function")
os.Exit(1)
}

setupLog.Info("starting manager")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
Expand Down

0 comments on commit 7eff97a

Please sign in to comment.