A cross-platform service manager
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
452 B

package runner
import (
"fmt"
"os/exec"
"strconv"
"syscall"
)
func backgroundCmd(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
}
func kill(pid int) error {
// Kill the whole processes tree (all children and grandchildren)
cmd := exec.Command("taskkill", "/pid", strconv.Itoa(pid), "/T", "/F")
b, err := cmd.CombinedOutput()
if nil != err {
return fmt.Errorf("%s: %s", err.Error(), string(b))
}
return nil
}