1
0
mirror of https://github.com/aquasecurity/kube-bench.git synced 2024-12-18 12:48:08 +00:00

add glog flush to write the output to a file (#329)

* add glog flush to write the output to a file

* add glog flush before exit on error and fix code comment
This commit is contained in:
patelpayal 2019-07-01 01:49:46 -07:00 committed by Liz Rice
parent 5e6cdfdb0e
commit e6e6333e6d
2 changed files with 6 additions and 0 deletions

View File

@ -74,8 +74,12 @@ func Execute() {
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
// flush before exit non-zero
glog.Flush()
os.Exit(-1)
}
// flush before exit
glog.Flush()
}
func init() {

View File

@ -35,6 +35,8 @@ func init() {
func exitWithError(err error) {
fmt.Fprintf(os.Stderr, "\n%v\n", err)
// flush before exit non-zero
glog.Flush()
os.Exit(1)
}