1
0
mirror of https://github.com/kataras/iris.git synced 2026-03-05 16:05:58 +00:00

Catch os.Interrupt signal with iris.PostInterrupt example added in comments.

https://github.com/iris-contrib/examples/tree/master/os_interrupt
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-01-11 18:01:29 +02:00
parent 5ad7c6e01f
commit 23f9ad13a1
3 changed files with 16 additions and 0 deletions

View File

@@ -541,7 +541,9 @@ func (s *Framework) postServe() {
ch := make(chan os.Signal, 1)
signal.Notify(ch, os.Interrupt)
<-ch
// catch custom plugin event for interrupt
// Example: https://github.com/iris-contrib/examples/tree/master/os_interrupt
s.Plugins.DoPostInterrupt(s)
if !s.Plugins.PostInterruptFired() {
// if no PostInterrupt events fired, then I assume that the user doesn't cares