JM-WechatMini/utils/reload.go

19 lines
266 B
Go
Raw Normal View History

2023-11-02 04:34:46 +08:00
package utils
import (
"errors"
"os"
"os/exec"
"runtime"
"strconv"
)
func Reload() error {
if runtime.GOOS == "windows" {
return errors.New("系统不支持")
}
pid := os.Getpid()
cmd := exec.Command("kill", "-1", strconv.Itoa(pid))
return cmd.Run()
}