Skip to content

Commit

Permalink
Fix search. Now it will only return a daemon pointer if it is live
Browse files Browse the repository at this point in the history
  • Loading branch information
stew3254 committed Feb 27, 2021
1 parent bf83969 commit ddc0bfd
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 ddc0bfd

Please sign in to comment.