avoid calling os.Exit outside main.go (#12459)
I don't think we should call os.Exit outside main.go. Calling os.Exit breaks the application control flow.
This commit is contained in:
committed by
Torkel Ödegaard
parent
7a4858dd11
commit
88783d6e0a
@@ -175,7 +175,7 @@ func (g *GrafanaServerImpl) Shutdown(reason string) {
|
||||
g.childRoutines.Wait()
|
||||
}
|
||||
|
||||
func (g *GrafanaServerImpl) Exit(reason error) {
|
||||
func (g *GrafanaServerImpl) Exit(reason error) int {
|
||||
// default exit code is 1
|
||||
code := 1
|
||||
|
||||
@@ -185,9 +185,7 @@ func (g *GrafanaServerImpl) Exit(reason error) {
|
||||
}
|
||||
|
||||
g.log.Error("Server shutdown", "reason", reason)
|
||||
|
||||
log.Close()
|
||||
os.Exit(code)
|
||||
return code
|
||||
}
|
||||
|
||||
func (g *GrafanaServerImpl) writePIDFile() {
|
||||
|
||||
Reference in New Issue
Block a user