Browse Source

fix: catch process termination signal to clear socket file

Hintay 7 months ago
parent
commit
e634c75804
1 changed files with 2 additions and 2 deletions
  1. 2 2
      main.go

+ 2 - 2
main.go

@@ -10,8 +10,8 @@ import (
 	"fmt"
 	"net"
 	"net/http"
-	"os"
 	"os/signal"
+	"syscall"
 
 	"github.com/0xJacky/Nginx-UI/internal/cert"
 	"github.com/0xJacky/Nginx-UI/internal/cmd"
@@ -108,7 +108,7 @@ func main() {
 	confPath := appCmd.String("config")
 	settings.Init(confPath)
 
-	ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
+	ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
 	defer cancel()
 
 	err := risefront.New(ctx, risefront.Config{