Skip to content

Commit

Permalink
Show message for force exit
Browse files Browse the repository at this point in the history
  • Loading branch information
yudai committed Sep 1, 2015
1 parent ff92777 commit 05d9267
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/app.go
Expand Up @@ -286,8 +286,11 @@ func (app *App) handleAuthToken(w http.ResponseWriter, r *http.Request) {

func (app *App) Exit() (firstCall bool) {
if app.server != nil {
log.Printf("Received Exit command, waiting for all clients to close sessions...")
return app.server.Close()
firstCall = app.server.Close()
if firstCall {
log.Printf("Received Exit command, waiting for all clients to close sessions...")
}
return firstCall
}
return true
}
Expand Down
4 changes: 3 additions & 1 deletion main.go
Expand Up @@ -120,7 +120,9 @@ func registerSignals(app *app.App) {
s := <-sigChan
switch s {
case syscall.SIGINT, syscall.SIGTERM:
if !app.Exit() {
if app.Exit() {
fmt.Println("Send ^C to force exit.")
} else {
os.Exit(5)
}
}
Expand Down

0 comments on commit 05d9267

Please sign in to comment.