2018-02-05 21:05:59 +00:00
|
|
|
package system // import "github.com/docker/docker/pkg/system"
|
2017-09-22 13:52:41 +00:00
|
|
|
|
|
|
|
import "os"
|
|
|
|
|
|
|
|
// IsProcessAlive returns true if process with a given pid is running.
|
|
|
|
func IsProcessAlive(pid int) bool {
|
|
|
|
_, err := os.FindProcess(pid)
|
|
|
|
|
|
|
|
return err == nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// KillProcess force-stops a process.
|
|
|
|
func KillProcess(pid int) {
|
|
|
|
p, err := os.FindProcess(pid)
|
|
|
|
if err == nil {
|
2020-03-09 15:36:24 +00:00
|
|
|
_ = p.Kill()
|
2017-09-22 13:52:41 +00:00
|
|
|
}
|
|
|
|
}
|