Replace tskill with taskkill
This offers a more reliable way of killing a process. The /IM flag allows us to specify the "image name" of the process we're killing. This means we can use wildcards, foce kill a process and all the child processes it may have spawned. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
fd07b03689
commit
0ff87a8929
@ -364,7 +364,7 @@ func Randomize(str string) string {
|
|||||||
func KillProcess(name string) error {
|
func KillProcess(name string) error {
|
||||||
var command []string
|
var command []string
|
||||||
if goruntime.GOOS == "windows" {
|
if goruntime.GOOS == "windows" {
|
||||||
command = []string{"tskill", strings.TrimSuffix(name, ".exe")}
|
command = []string{"taskkill", "/IM", name, "/F"}
|
||||||
} else {
|
} else {
|
||||||
command = []string{"pkill", "-x", fmt.Sprintf("^%s$", name)}
|
command = []string{"pkill", "-x", fmt.Sprintf("^%s$", name)}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user