Skip to content

Commit

Permalink
Catch SIGTERM
Browse files Browse the repository at this point in the history
  • Loading branch information
AlinaNova21 committed Sep 6, 2019
1 parent 83165ff commit a1f50d7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (l *Launcher) Start() error {
log.Print("Started")
}
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGHUP)
signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGTERM)
for {
select {
case sig := <-c:
Expand Down Expand Up @@ -155,9 +155,11 @@ func (l *Launcher) Start() error {
} else {
log.Print("Started")
}
case syscall.SIGINT:
case syscall.SIGTERM:
fallthrough
case syscall.SIGKILL:
case os.Interrupt:
fallthrough
case os.Kill:
log.Printf("Stopping")
if err := s.Stop(); err != nil {
log.Printf("Error while stopping: %v", err)
Expand Down

0 comments on commit a1f50d7

Please sign in to comment.