Merge pull request #14173 from SimFG/ctl_err

ectdctl: Add the `SilenceErrors` config For the `cobra.Command`
This commit is contained in:
Benjamin Wang 2022-07-05 06:10:11 +08:00 committed by GitHub
commit 07d620822f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,7 @@
package ctlv3
import (
"os"
"time"
"go.etcd.io/etcd/api/v3/version"
@ -114,7 +115,11 @@ func Start() error {
func MustStart() {
if err := Start(); err != nil {
cobrautl.ExitWithError(cobrautl.ExitError, err)
if rootCmd.SilenceErrors {
cobrautl.ExitWithError(cobrautl.ExitError, err)
} else {
os.Exit(cobrautl.ExitError)
}
}
}