You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
288 B
Go
18 lines
288 B
Go
1 year ago
|
//go:build !windows
|
||
|
|
||
|
package nsys
|
||
|
|
||
|
import (
|
||
|
"syscall"
|
||
|
)
|
||
|
|
||
|
// Kill a process by pid
|
||
|
func Kill(pid int, signal syscall.Signal) error {
|
||
|
return syscall.Kill(pid, signal)
|
||
|
}
|
||
|
|
||
|
// ProcessExists check process exists by pid
|
||
|
func ProcessExists(pid int) bool {
|
||
|
return nil == syscall.Kill(pid, 0)
|
||
|
}
|