Skip to content

Commit

Permalink
Merge pull request #125 from lachlanorr/master
Browse files Browse the repository at this point in the history
Return a meaningful reattach error for non-existent pids on Windows
  • Loading branch information
Mahmood Ali committed Oct 4, 2019
2 parents 9e3e1c3 + dfbe846 commit 8091134
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,10 @@ func (c *Client) reattach() (net.Addr, error) {
// Verify the process still exists. If not, then it is an error
p, err := os.FindProcess(c.config.Reattach.Pid)
if err != nil {
return nil, err
// On Unix systems, FindProcess never returns an error.
// On Windows, for non-existent pids it returns:
// os.SyscallError - 'OpenProcess: the paremter is incorrect'
return nil, ErrProcessNotFound
}

// Attempt to connect to the addr since on Unix systems FindProcess
Expand Down

0 comments on commit 8091134

Please sign in to comment.