flush logs on cmd failure (#1338)
## Description The secondary scripts in corso (factory, purge, etc) are not currently flushing their logs if an error occurrs since os.Exit(1) kills the current process without alloting time for deferred funcs to run. ## Type of change - [x] 🐛 Bugfix ## Issue(s) * #902 ## Test Plan - [x] 💚 E2E
This commit is contained in:
parent
b7a7b22f94
commit
a31b01458c
@ -79,6 +79,7 @@ func main() {
|
||||
addOneDriveCommands(oneDriveCmd)
|
||||
|
||||
if err := factoryCmd.ExecuteContext(ctx); err != nil {
|
||||
logger.Flush(ctx)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +63,7 @@ func main() {
|
||||
cobra.CheckErr(getCmd.MarkPersistentFlagRequired("category"))
|
||||
|
||||
if err := getCmd.ExecuteContext(ctx); err != nil {
|
||||
logger.Flush(ctx)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,6 +88,7 @@ func main() {
|
||||
purgeCmd.AddCommand(oneDriveCmd)
|
||||
|
||||
if err := purgeCmd.ExecuteContext(ctx); err != nil {
|
||||
logger.Flush(ctx)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user