1// +build linux freebsd darwin
2
3package system // import "github.com/ory/dockertest/docker/pkg/system"
4
5import (
6	"syscall"
7
8	"golang.org/x/sys/unix"
9)
10
11// IsProcessAlive returns true if process with a given pid is running.
12func IsProcessAlive(pid int) bool {
13	err := unix.Kill(pid, syscall.Signal(0))
14	if err == nil || err == unix.EPERM {
15		return true
16	}
17
18	return false
19}
20
21// KillProcess force-stops a process.
22func KillProcess(pid int) {
23	unix.Kill(pid, unix.SIGKILL)
24}
25