github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/pkg/system/process_windows.go (about) 1 package system // import "github.com/demonoid81/moby/pkg/system" 2 3 import "os" 4 5 // IsProcessAlive returns true if process with a given pid is running. 6 func IsProcessAlive(pid int) bool { 7 _, err := os.FindProcess(pid) 8 9 return err == nil 10 } 11 12 // KillProcess force-stops a process. 13 func KillProcess(pid int) { 14 p, err := os.FindProcess(pid) 15 if err == nil { 16 _ = p.Kill() 17 } 18 }