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:
parent
17fac7cbba
commit
0439039205
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue