把 github.com/Autumn-27/norma v0.4.3(commit 320ae32)的源码复制到 third_party/norma,并用 go.mod 的 replace 指向本地副本。上游删除仓库或 改写 tag 都不再影响本仓库构建。 - 已验证 GOPROXY=off 下可完整编译并打出发行包 - go.sum 中该模块的两条校验记录随之删除(本地 replace 不需要哈希) - 升级方法与授权注意事项见 third_party/README.md
27 lines
603 B
Go
27 lines
603 B
Go
//go:build windows
|
|
|
|
package tool
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"strconv"
|
|
"syscall"
|
|
)
|
|
|
|
// createNewProcessGroup isolates the child from our console so it survives the
|
|
// per-turn context.
|
|
const createNewProcessGroup = 0x00000200 // CREATE_NEW_PROCESS_GROUP
|
|
|
|
func setDetached(cmd *exec.Cmd) {
|
|
if cmd.SysProcAttr == nil {
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
|
}
|
|
cmd.SysProcAttr.CreationFlags |= createNewProcessGroup
|
|
}
|
|
|
|
// treeKill terminates the process and its descendants via taskkill.
|
|
func treeKill(p *os.Process) {
|
|
_ = exec.Command("taskkill", "/T", "/F", "/PID", strconv.Itoa(p.Pid)).Run()
|
|
}
|