Add workaround for NewProcess on Windows

This commit is contained in:
Daniel
2019-07-24 10:02:09 +02:00
parent 169901ccef
commit cad3490ec1
2 changed files with 9 additions and 1 deletions

View File

@@ -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