Files
TorrServerJellyfin/server/cmd/preconfig_pos.go
deepsource-autofix[bot] 2d1e693623 Fix useless trapping of signal
2021-05-03 19:42:35 +00:00

32 lines
444 B
Go

// +build !windows
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
)
func Preconfig(dkill bool) {
if dkill {
sigc := make(chan os.Signal, 1)
signal.Notify(sigc,
syscall.SIGHUP,
syscall.SIGINT,
syscall.SIGPIPE,
syscall.SIGTERM,
syscall.SIGQUIT)
go func() {
for s := range sigc {
if dkill {
fmt.Println("Signal catched:", s)
fmt.Println("For stop server, close in api")
}
}
}()
}
}