delete unused trap
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/signal"
|
||||
|
||||
"github.com/oklog/run"
|
||||
)
|
||||
|
||||
// Trap listens to interrupt signals and handles context cancellation and channel closing on a group run.
|
||||
func Trap(gr *run.Group, cancel context.CancelFunc) {
|
||||
stop := make(chan os.Signal, 1)
|
||||
gr.Add(func() error {
|
||||
signal.Notify(stop, os.Interrupt)
|
||||
<-stop
|
||||
return nil
|
||||
}, func(err error) {
|
||||
cancel()
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user