MCPcopy Create free account
hub / github.com/MertJSX/folderhost / KillProcess

Function KillProcess

utils/service_utils/service_functions.go:38–49  ·  view source on GitHub ↗
(pid int)

Source from the content-addressed store, hash-verified

36}
37
38func KillProcess(pid int) error {
39 if runtime.GOOS == "windows" {
40 cmd := exec.Command("taskkill", "/F", "/T", "/PID", strconv.Itoa(pid))
41 return cmd.Run()
42 } else {
43 process, err := os.FindProcess(pid)
44 if err != nil {
45 return err
46 }
47 return process.Signal(os.Kill)
48 }
49}
50
51func TerminateProcess(pid int) error {
52 if runtime.GOOS == "windows" {

Callers 2

ShutdownMethod · 0.85
forceKillAllMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected