Shutdown server gracefully with Ctrl-C

This commit is contained in:
Iwasaki Yudai 2015-08-24 19:22:25 +09:00
parent 94a6230355
commit e613b29cc3
3 changed files with 45 additions and 2 deletions

View file

@ -61,7 +61,10 @@ func (context *clientContext) goHandleClient() {
context.processReceive()
}()
context.app.server.StartRoutine()
go func() {
defer context.app.server.FinishRoutine()
<-exit
context.pty.Close()
context.command.Wait()