add option for web service signal handler (#1091)

This commit is contained in:
shikbupt
2020-01-10 22:25:28 +08:00
committed by Asim Aslam
parent 37d1139a57
commit 32a2005f6d
2 changed files with 15 additions and 1 deletions

View File

@@ -383,7 +383,9 @@ func (s *service) Run() error {
go s.run(ex)
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGTERM, syscall.SIGINT)
if s.opts.Signal {
signal.Notify(ch, syscall.SIGTERM, syscall.SIGINT)
}
select {
// wait on kill signal