gracefully shutdown xray-core

This commit is contained in:
Alireza Ahmadi
2023-06-14 22:29:39 +02:00
parent 06ae50c402
commit e1e5899a90

View File

@@ -11,6 +11,7 @@ import (
"os/exec" "os/exec"
"runtime" "runtime"
"strings" "strings"
"syscall"
"x-ui/config" "x-ui/config"
"x-ui/util/common" "x-ui/util/common"
@@ -220,5 +221,5 @@ func (p *process) Stop() error {
if !p.IsRunning() { if !p.IsRunning() {
return errors.New("xray is not running") return errors.New("xray is not running")
} }
return p.cmd.Process.Kill() return p.cmd.Process.Signal(syscall.SIGTERM)
} }