暂存

tmp
This commit is contained in:
2024-05-09 16:35:21 +08:00
parent 3afa0d81bb
commit bcc1b51006
27 changed files with 1526 additions and 0 deletions

22
core/restart.go Normal file
View File

@@ -0,0 +1,22 @@
package core
import (
"os"
"syscall"
)
func RestartSelf() {
executable, err := os.Executable()
if err != nil {
panic("获取可执行文件路径失败: " + err.Error())
}
args := os.Args
env := os.Environ()
// 使用exec替换当前进程为新的进程
err = syscall.Exec(executable, args, env)
if err != nil {
panic("重启失败: " + err.Error())
}
}