Skip to content

Commit 9a6a2e8

Browse files
committed
v2/version: return error instead of exitting immediately
Let `main` finish and call `os.Exit`
1 parent 0478f25 commit 9a6a2e8

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

v2/internal/pkg/version/version.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,12 @@ func NewVersionCommand(log clog.PluggableLoggerInterface) *cobra.Command {
6363
# Get oc-mirror version
6464
oc-mirror version
6565
`),
66-
Run: func(cmd *cobra.Command, args []string) {
66+
RunE: func(cmd *cobra.Command, args []string) error {
6767
if err := o.Validate(); err != nil {
68-
log.Error(" %v ", err)
69-
os.Exit(1)
68+
return err
7069
}
7170

72-
if err := o.Run(); err != nil {
73-
log.Error(" %v ", err)
74-
os.Exit(1)
75-
}
71+
return o.Run()
7672
},
7773
}
7874

0 commit comments

Comments
 (0)