Terminate process if server cant be starter

This commit is contained in:
Dan Sosedoff 2015-02-09 01:40:51 -06:00
parent 717bc0d919
commit 772e854aa6

View File

@ -96,7 +96,13 @@ func startServer() {
setupRoutes(router) setupRoutes(router)
fmt.Println("Starting server...") fmt.Println("Starting server...")
go router.Run(fmt.Sprintf("%v:%v", options.HttpHost, options.HttpPort)) go func() {
err := router.Run(fmt.Sprintf("%v:%v", options.HttpHost, options.HttpPort))
if err != nil {
fmt.Println("Cant start server:", err)
os.Exit(1)
}
}()
} }
func handleSignals() { func handleSignals() {