Add workaround for NewProcess on Windows
This commit is contained in:
@@ -264,7 +264,13 @@ func loadProcess(ctx context.Context, pid int) (*Process, error) {
|
||||
|
||||
pInfo, err := processInfo.NewProcess(int32(pid))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
// TODO: remove this workaround as soon as NewProcess really returns an error on windows when the process does not exist
|
||||
// Issue: https://github.com/shirou/gopsutil/issues/729
|
||||
_, err = pInfo.Name()
|
||||
if err != nil {
|
||||
// process does not exists
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// UID
|
||||
|
||||
Reference in New Issue
Block a user