package stat import ( "os" "runtime" "syscall" "kumoly.io/lib/klog" ) func IsRunning(pid int) bool { p, err := os.FindProcess(pid) if err != nil { klog.Debug(err) return false } if runtime.GOOS == "windows" { return true } err = p.Signal(syscall.Signal(0)) if err == syscall.ESRCH { return false } // running // if err == nil { // return true // } // other errors ignored but we know that the proccess is running return true }