refactor(process): compare error with `errors.Is`

Starting from Go 1.13, `errors.Is` is the preferable way to compare
error equality [1].

[1]: https://go.dev/blog/go1.13-errors

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun 2023-04-24 15:00:01 +08:00
parent 17fac7cbba
commit 0439039205
No known key found for this signature in database
GPG Key ID: DAEBBD2E34C111E6
1 changed files with 1 additions and 1 deletions

View File

@ -122,7 +122,7 @@ func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) {
if err == nil {
return true, nil
}
if err.Error() == "os: process already finished" {
if errors.Is(err, os.ErrProcessDone) {
return false, nil
}
var errno syscall.Errno