Skip to content

Commit 6296607

Browse files
committed
v2/version: return error instead of exiting immediately
Let `main` finish and call `os.Exit`
1 parent 4cbea0c commit 6296607

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
@@ -93,16 +93,12 @@ func NewVersionCommand(log clog.PluggableLoggerInterface) *cobra.Command {
9393
# Get oc-mirror version
9494
oc-mirror version
9595
`),
96-
Run: func(cmd *cobra.Command, args []string) {
96+
RunE: func(cmd *cobra.Command, args []string) error {
9797
if err := o.Validate(); err != nil {
98-
log.Error(" %v ", err)
99-
os.Exit(1)
98+
return err
10099
}
101100

102-
if err := o.Run(); err != nil {
103-
log.Error(" %v ", err)
104-
os.Exit(1)
105-
}
101+
return o.Run()
106102
},
107103
}
108104

0 commit comments

Comments
 (0)