add kill the process

This commit is contained in:
vcaesar 2017-11-29 16:22:16 +08:00
parent b1d4b3a101
commit 18029106ac
2 changed files with 16 additions and 2 deletions

View File

@ -48,6 +48,7 @@ import "C"
import (
// "fmt"
"os"
"reflect"
"runtime"
"strings"
@ -59,7 +60,7 @@ import (
)
const (
version string = "v0.46.6.407, Pyrenees Mountains!"
version string = "v0.46.6.428, Pyrenees Mountains!"
)
// GetVersion get version
@ -900,3 +901,9 @@ func FindIds(name string) ([]int32, error) {
func ActivePID(pid int32) {
C.active_PID(C.uintptr(pid))
}
// Kill kill the process by PID
func Kill(pid int) error {
ps := os.Process{Pid: pid}
return ps.Kill()
}

View File

@ -51,6 +51,7 @@ import "C"
import (
// "fmt"
"os"
"reflect"
"runtime"
"strings"
@ -62,7 +63,7 @@ import (
)
const (
version string = "v0.46.6.423, Pyrenees Mountains!"
version string = "v0.46.6.428, Pyrenees Mountains!"
)
// GetVersion get version
@ -1131,3 +1132,9 @@ func FindIds(name string) ([]int32, error) {
func ActivePID(pid int32) {
C.active_PID(C.uintptr(pid))
}
// Kill kill the process by PID
func Kill(pid int) error {
ps := os.Process{Pid: pid}
return ps.Kill()
}