Skip to content

Commit

Permalink
fix exit status code (fabiolb#637)
Browse files Browse the repository at this point in the history
Fabio always returned status code 1. Event on clean exit.
Shutdown of http server is treated as fatal:
 [FATAL] http: Server closed
 [FATAL] ui: http: Server closed

Http server Serve method always returns non nil error:
https://golang.org/pkg/net/http/#Server.Serve

ErrServerClosed should be treated as clean exit.
"After Shutdown or Close, the returned error is ErrServerClosed."
  • Loading branch information
ianic authored and aaronhurt committed Apr 12, 2019
1 parent 084f879 commit 3d02439
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion proxy/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,8 @@ func serve(ln net.Listener, srv Server) error {
mu.Lock()
servers = append(servers, srv)
mu.Unlock()
return srv.Serve(ln)
if err := srv.Serve(ln); err != http.ErrServerClosed {
return err
}
return nil
}

0 comments on commit 3d02439

Please sign in to comment.