blob: c99d796d1317c28c9da3a2abf6308ba68f260861 [file] [log] [blame]
// +build linux freebsd solaris darwin
package system
import (
"syscall"
)
// IsProcessAlive returns true if process with a given pid is running.
func IsProcessAlive(pid int) bool {
err := syscall.Kill(pid, syscall.Signal(0))
if err == nil || err == syscall.EPERM {
return true
}
return false
}
// KillProcess force-stops a process.
func KillProcess(pid int) {
syscall.Kill(pid, syscall.SIGKILL)
}