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
pull/324/head^2 v0.0.30
patelpayal 5 years ago committed by Liz Rice
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…
Cancel
Save