1
0

Added a handler for SIGHUP signal that is used for playlist reloading.

This commit is contained in:
Alexander Andreev 2023-10-05 17:37:13 +04:00
parent f8fd13f8ed
commit 8079058b5c
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -99,6 +99,18 @@ func main() {
}
}()
reloadSignal := make(chan os.Signal, 1)
signal.Notify(reloadSignal, syscall.SIGHUP)
go func() {
for {
<-reloadSignal
if err := plylst.Reload(); err != nil {
log.Println(err)
}
}
}()
doneSignal := make(chan os.Signal, 1)
signal.Notify(doneSignal, os.Interrupt, syscall.SIGINT, syscall.SIGTERM, syscall.SIGABRT, syscall.SIGSEGV)