mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
28 lines
418 B
Go
28 lines
418 B
Go
//go:build windows
|
|
|
|
package tools
|
|
|
|
import (
|
|
"os/exec"
|
|
"strconv"
|
|
)
|
|
|
|
func prepareCommandForTermination(cmd *exec.Cmd) {
|
|
// no-op on Windows
|
|
}
|
|
|
|
func terminateProcessTree(cmd *exec.Cmd) error {
|
|
if cmd == nil || cmd.Process == nil {
|
|
return nil
|
|
}
|
|
|
|
pid := cmd.Process.Pid
|
|
if pid <= 0 {
|
|
return nil
|
|
}
|
|
|
|
_ = exec.Command("taskkill", "/T", "/F", "/PID", strconv.Itoa(pid)).Run()
|
|
_ = cmd.Process.Kill()
|
|
return nil
|
|
}
|