Closed WeiZhang555 closed 7 years ago
The reason that this commit works is that in https://github.com/hyperhq/runv/blob/master/main.go#L144-L148 , there is a glog.Flush()
to flush all the logs after the APP exits, but if we call os.Exit
in middle directly, there's no way to flush all the logs, hence cached logs would be lost.
With this modification, glog.Flush
will always be called when program exits normally (except panic), and we could get all logs for debugging.
Do not call os.Exit directly in codes, but call "return cli.NewExitError" instead, so that after the program terminated, glog can flush and no logs will be lost.
Signed-off-by: Zhang Wei zhangwei555@huawei.com