Rewrite shell signal handling

This commit is contained in:
Alexey Khit
2023-05-20 06:29:14 +03:00
parent e29307125c
commit 82a8e07b66
5 changed files with 59 additions and 48 deletions
+20
View File
@@ -0,0 +1,20 @@
package main
import (
"github.com/AlexxIT/go2rtc/internal/api"
"github.com/AlexxIT/go2rtc/internal/app"
"github.com/AlexxIT/go2rtc/internal/hass"
"github.com/AlexxIT/go2rtc/internal/streams"
"github.com/AlexxIT/go2rtc/pkg/shell"
)
func main() {
app.Init()
streams.Init()
api.Init()
hass.Init()
shell.RunUntilSignal()
}
+2 -8
View File
@@ -4,9 +4,7 @@ import (
"github.com/AlexxIT/go2rtc/internal/app"
"github.com/AlexxIT/go2rtc/internal/rtsp"
"github.com/AlexxIT/go2rtc/internal/streams"
"os"
"os/signal"
"syscall"
"github.com/AlexxIT/go2rtc/pkg/shell"
)
func main() {
@@ -15,9 +13,5 @@ func main() {
rtsp.Init()
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
<-sigs
println("exit OK")
shell.RunUntilSignal()
}