chore: cleanup listener before restart
This commit is contained in:
parent
304b4d9bcb
commit
ecdde647b1
1 changed files with 2 additions and 1 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/Dreamacro/clash/listener"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/Dreamacro/clash/log"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
|
@ -43,7 +44,7 @@ func restart(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func runRestart(execPath string) {
|
func runRestart(execPath string) {
|
||||||
var err error
|
var err error
|
||||||
|
listener.Cleanup(false)
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
cmd := exec.Command(execPath, os.Args[1:]...)
|
cmd := exec.Command(execPath, os.Args[1:]...)
|
||||||
log.Infoln("restarting: %q %q", execPath, os.Args[1:])
|
log.Infoln("restarting: %q %q", execPath, os.Args[1:])
|
||||||
|
|
Loading…
Reference in a new issue