✨ init project
This commit is contained in:
18
utils/reload.go
Normal file
18
utils/reload.go
Normal file
@@ -0,0 +1,18 @@
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user