Skip to content

Commit

Permalink
Merge pull request #72 from stew3254/master
Browse files Browse the repository at this point in the history
Fix search. Now it will only return a daemon pointer if it is live
  • Loading branch information
deniszh committed May 24, 2021
2 parents a81bc70 + ddc0bfd commit 3fdf7dc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions daemon_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ func (d *Context) search() (daemon *os.Process, err error) {
return
}
daemon, err = os.FindProcess(pid)
if err == nil && daemon != nil {
// Send a test signal to test if this daemon is actually alive or dead
// An error means it is dead
if daemon.Signal(syscall.Signal(0)) != nil {
daemon = nil
}
}
}
return
}
Expand Down

0 comments on commit 3fdf7dc

Please sign in to comment.