delete unused trap

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2024-10-28 14:47:11 +01:00
parent 64d7aba1f6
commit ad43ae824c
33 changed files with 18 additions and 131 deletions
-21
View File
@@ -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()
})
}