mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-26 13:48:59 +08:00
Merge pull request #1508 from gdvalle/gtd.disk.serial-num-fix
fix IOCounters() SerialNumber enumeration
This commit is contained in:
commit
6084c1e2a4
@ -474,7 +474,11 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
|
||||
}
|
||||
d.Name = name
|
||||
|
||||
d.SerialNumber, _ = SerialNumberWithContext(ctx, name)
|
||||
// Names passed in can be full paths (/dev/sda) or just device names (sda).
|
||||
// Since `name` here is already a basename, re-add the /dev path.
|
||||
// This is not ideal, but we may break the API by changing how SerialNumberWithContext
|
||||
// works.
|
||||
d.SerialNumber, _ = SerialNumberWithContext(ctx, common.HostDevWithContext(ctx, name))
|
||||
d.Label, _ = LabelWithContext(ctx, name)
|
||||
|
||||
ret[name] = d
|
||||
|
Loading…
x
Reference in New Issue
Block a user