Merge pull request #1317 from kerthcet/bug/flush-in-karmadactl

bug: karmadactl's os.Exit will not wait for the defer function
This commit is contained in:
karmada-bot 2022-01-29 10:14:34 +08:00 committed by GitHub
commit a2959f1dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -9,10 +9,18 @@ import (
)
func main() {
if err := runKarmadaCtlCmd(); err != nil {
os.Exit(1)
}
}
func runKarmadaCtlCmd() error {
logs.InitLogs()
defer logs.FlushLogs()
if err := karmadactl.NewKarmadaCtlCommand(os.Stdout, "karmadactl", "karmadactl").Execute(); err != nil {
os.Exit(1)
return err
}
return nil
}