1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-28 13:48:49 +08:00

Merge pull request #1688 from zmyzheng/zmyzheng/fix-IOCountersWithContext

fix(IOCountersWithContext): Fix the issue of not using names to fil ter devices in func IOCountersWithContext of the windows implementation
This commit is contained in:
shirou 2024-08-14 22:16:55 +09:00 committed by GitHub
commit edff3add94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -218,6 +218,8 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
if err != nil {
return drivemap, err
}
if len(names) == 0 || common.StringsHas(names, path) {
drivemap[path] = IOCountersStat{
ReadBytes: uint64(diskPerformance.BytesRead),
WriteBytes: uint64(diskPerformance.BytesWritten),
@ -229,6 +231,7 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
}
}
}
}
return drivemap, nil
}