process_posix.go 335 B

12345678910111213141516171819
  1. // +build !windows
  2. package plugin
  3. import (
  4. "os"
  5. "syscall"
  6. )
  7. // _pidAlive tests whether a process is alive or not by sending it Signal 0,
  8. // since Go otherwise has no way to test this.
  9. func _pidAlive(pid int) bool {
  10. proc, err := os.FindProcess(pid)
  11. if err == nil {
  12. err = proc.Signal(syscall.Signal(0))
  13. }
  14. return err == nil
  15. }