cpuTemperature() fix try catch (linux)
This commit is contained in:
parent
659f2b1225
commit
dfc19f55bb
@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 4.27.5 | 2020-09-18 | `cpuTemperature()` fix try catch (linux) |
|
||||||
| 4.27.4 | 2020-09-16 | `networkInterfaceDefault()` optimization (macOS) |
|
| 4.27.4 | 2020-09-16 | `networkInterfaceDefault()` optimization (macOS) |
|
||||||
| 4.27.3 | 2020-08-26 | updated typescript typings |
|
| 4.27.3 | 2020-08-26 | updated typescript typings |
|
||||||
| 4.27.2 | 2020-08-26 | fixed issue breaking node v4 compatibility |
|
| 4.27.2 | 2020-08-26 | fixed issue breaking node v4 compatibility |
|
||||||
|
|||||||
@ -83,6 +83,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">4.27.5</th>
|
||||||
|
<td>2020-09-18</td>
|
||||||
|
<td><span class="code">cpuTemperature()</span> fixed try catch (linux)</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">4.27.4</th>
|
<th scope="row">4.27.4</th>
|
||||||
<td>2020-09-16</td>
|
<td>2020-09-16</td>
|
||||||
|
|||||||
@ -168,7 +168,7 @@
|
|||||||
<img class="logo" src="assets/logo.png">
|
<img class="logo" src="assets/logo.png">
|
||||||
<div class="title">systeminformation</div>
|
<div class="title">systeminformation</div>
|
||||||
<div class="subtitle"><span id="typed"></span></div>
|
<div class="subtitle"><span id="typed"></span></div>
|
||||||
<div class="version">Current Version: <span id="version">4.27.4</span></div>
|
<div class="version">Current Version: <span id="version">4.27.5</span></div>
|
||||||
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="down">
|
<div class="down">
|
||||||
|
|||||||
16
lib/cpu.js
16
lib/cpu.js
@ -758,6 +758,7 @@ function cpuTemperature(callback) {
|
|||||||
};
|
};
|
||||||
if (_linux) {
|
if (_linux) {
|
||||||
const cmd = 'cat /sys/class/hwmon/hwmon1/temp*_la*;echo "---";cat /sys/class/hwmon/hwmon1/temp*_i*';
|
const cmd = 'cat /sys/class/hwmon/hwmon1/temp*_la*;echo "---";cat /sys/class/hwmon/hwmon1/temp*_i*';
|
||||||
|
try {
|
||||||
exec(cmd, function (error, stdout) {
|
exec(cmd, function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let parts = stdout.toString().split('---');
|
let parts = stdout.toString().split('---');
|
||||||
@ -852,6 +853,10 @@ function cpuTemperature(callback) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} catch (er) {
|
||||||
|
if (callback) { callback(result); }
|
||||||
|
resolve(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_freebsd || _openbsd || _netbsd) {
|
if (_freebsd || _openbsd || _netbsd) {
|
||||||
exec('sysctl dev.cpu | grep temp', function (error, stdout) {
|
exec('sysctl dev.cpu | grep temp', function (error, stdout) {
|
||||||
@ -962,6 +967,8 @@ function cpuFlags(callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_linux) {
|
if (_linux) {
|
||||||
|
try {
|
||||||
|
|
||||||
exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) {
|
exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let lines = stdout.toString().split('\n');
|
let lines = stdout.toString().split('\n');
|
||||||
@ -985,6 +992,10 @@ function cpuFlags(callback) {
|
|||||||
resolve(result);
|
resolve(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
if (callback) { callback(result); }
|
||||||
|
resolve(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_freebsd || _openbsd || _netbsd) {
|
if (_freebsd || _openbsd || _netbsd) {
|
||||||
exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
||||||
@ -1041,6 +1052,7 @@ function cpuCache(callback) {
|
|||||||
l3: -1,
|
l3: -1,
|
||||||
};
|
};
|
||||||
if (_linux) {
|
if (_linux) {
|
||||||
|
try {
|
||||||
exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) {
|
exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let lines = stdout.toString().split('\n');
|
let lines = stdout.toString().split('\n');
|
||||||
@ -1063,6 +1075,10 @@ function cpuCache(callback) {
|
|||||||
if (callback) { callback(result); }
|
if (callback) { callback(result); }
|
||||||
resolve(result);
|
resolve(result);
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
if (callback) { callback(result); }
|
||||||
|
resolve(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_freebsd || _openbsd || _netbsd) {
|
if (_freebsd || _openbsd || _netbsd) {
|
||||||
exec('export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
exec('export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user