Skip to content

Commit 5132d13

Browse files
committed
Fix panic.
1 parent 84069e8 commit 5132d13

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cobracmd/root.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cobracmd
22

33
import (
4+
"log"
45
"os"
56

67
cmd "github.com/can3p/kleiner/shared/cmd/cobra"
@@ -27,7 +28,12 @@ func Execute() {
2728

2829
func init() {
2930
info := buildinfo.Info()
30-
3131
cmd.Setup(info, rootCmd)
32+
33+
defer func() {
34+
if r := recover(); r != nil {
35+
log.Printf("WARNING: %v", r)
36+
}
37+
}()
3238
published.MaybeNotifyAboutNewVersion(info)
3339
}

0 commit comments

Comments
 (0)