cpuTemperature() improved tdie detection (linus)

This commit is contained in:
Sebastian Hildebrandt
2021-09-17 08:30:45 +02:00
parent f98c463d0d
commit a3747ff048
5 changed files with 18 additions and 3 deletions
+6 -1
View File
@@ -967,7 +967,12 @@ function cpuTemperature(callback) {
const cmd = 'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=$(echo $label | rev | cut -c 7- | rev)_input; if [ -f "$value" ]; then echo $(cat "$label")___$(cat "$value"); fi; fi; done; done;';
try {
exec(cmd, function (error, stdout) {
let lines = stdout.toString().split('\n');
stdout = stdout.toString();
const tdiePos = stdout.toLowerCase().indexOf('tdie');
if (tdiePos !== -1) {
stdout = stdout.substring(tdiePos);
}
let lines = stdout.split('\n');
lines.forEach(line => {
const parts = line.split('___');
const label = parts[0];