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:
parent
5e6cdfdb0e
commit
e6e6333e6d
@ -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() {
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user