currentSpeed() added try catch
This commit is contained in:
parent
ce17a4ecda
commit
4bfd0c3ea5
12
lib/cpu.js
12
lib/cpu.js
@ -1001,10 +1001,14 @@ function getCpuCurrentSpeedSync() {
|
|||||||
for (let i in cpus) {
|
for (let i in cpus) {
|
||||||
speeds.push(cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10);
|
speeds.push(cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (_linux) {
|
||||||
speedStrings = execSync('cat /proc/cpuinfo | grep "cpu MHz" | cut -d " " -f 3', util.execOptsLinux).toString().split('\n');
|
try {
|
||||||
for (let i in speedStrings) {
|
speedStrings = execSync('cat /proc/cpuinfo | grep "cpu MHz" | cut -d " " -f 3', util.execOptsLinux).toString().split('\n');
|
||||||
speeds.push(parseInt(speedStrings, 10));
|
for (let i in speedStrings) {
|
||||||
|
speeds.push(parseInt(speedStrings, 10));
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
util.noop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user