mirror of
https://github.com/genuinetools/reg.git
synced 2024-08-21 14:20:23 -04:00
25 lines
465 B
Go
25 lines
465 B
Go
// +build linux freebsd darwin
|
|
|
|
package system // import "github.com/docker/docker/pkg/system"
|
|
|
|
import (
|
|
"syscall"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// IsProcessAlive returns true if process with a given pid is running.
|
|
func IsProcessAlive(pid int) bool {
|
|
err := unix.Kill(pid, syscall.Signal(0))
|
|
if err == nil || err == unix.EPERM {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// KillProcess force-stops a process.
|
|
func KillProcess(pid int) {
|
|
unix.Kill(pid, unix.SIGKILL)
|
|
}
|