diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-09-28 22:40:19 +0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-09-28 22:40:19 +0800 |
commit | 9632fb1969c526129eec63a267a6bcf91010228d (patch) | |
tree | fa05255c83d62a09f55fe1d7d77eec2d6ff71b7d | |
parent | d9247ed08bab0c6795492fb2cb847f6e9e6572f7 (diff) | |
download | psutil-9632fb1969c526129eec63a267a6bcf91010228d.tar.gz |
#1141: sensors_fans / linux: skip unreadable _input label for first
-rw-r--r-- | CREDITS | 4 | ||||
-rw-r--r-- | HISTORY.rst | 3 | ||||
-rw-r--r-- | psutil/_pslinux.py | 11 |
3 files changed, 11 insertions, 7 deletions
@@ -489,3 +489,7 @@ I: 1077, 1093, 1091 N: Prodesire W: https://github.com/Prodesire I: 1138 + +N: Sebastian Saip +W: https://github.com/ssaip +I: 1141 diff --git a/HISTORY.rst b/HISTORY.rst index 5c301a69..f2878b08 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -11,7 +11,8 @@ XXXX-XX-XX *Bug fixes* -- 1129_: [Linux] sensors_temperatures() may crash with IOError. +- 1009_: [Linux] sensors_temperatures() may crash with IOError. +- 1129_: [Linux] sensors_fans() may crash with IOError. - 1131_: [SunOS] fix compilation warnings. (patch by Arnon Yaari) - 1138_: [Linux] can't compile on CentOS 5.0 and RedHat 5.0. (patch by Prodesire) diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index 154a8d63..2fec8ea7 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -1170,8 +1170,8 @@ def sensors_temperatures(): def sensors_fans(): - """Return hardware (CPU and others) fans as a dict - including hardware label, current speed. + """Return hardware fans info (for CPU and other peripherals) as a + dict including hardware label and current speed. Implementation notes: - /sys/class/hwmon looks like the most recent interface to @@ -1188,15 +1188,14 @@ def sensors_fans(): basenames = sorted(set([x.split('_')[0] for x in basenames])) for base in basenames: - unit_name = cat(os.path.join(os.path.dirname(base), 'name'), - binary=False) - label = cat(base + '_label', fallback='', binary=False) try: current = int(cat(base + '_input')) except (IOError, OSError) as err: warnings.warn("ignoring %r" % err, RuntimeWarning) continue - + unit_name = cat(os.path.join(os.path.dirname(base), 'name'), + binary=False) + label = cat(base + '_label', fallback='', binary=False) ret[unit_name].append(_common.sfan(label, current)) return dict(ret) |