currentLoad() improved parsing (linux)

This commit is contained in:
Sebastian Hildebrandt
2023-11-09 06:40:15 +01:00
parent 3a558b27e3
commit bf5df7f63e
6 changed files with 13 additions and 7 deletions
+1 -1
View File
@@ -1604,7 +1604,7 @@ function getLoad() {
// linux: try to get other cpu stats
if (_linux) {
try {
const lines = execSync('cat /proc/stat 2>/dev/null | grep cpu').toString().split('\n');
const lines = execSync('cat /proc/stat 2>/dev/null | grep cpu', { encoding: 'utf8' }).toString().split('\n');
if (lines.length > 1) {
lines.shift();
if (lines.length === cpus.length) {
+1 -1
View File
@@ -211,7 +211,7 @@ function services(srv, callback) {
} else {
ps = lines.filter(function (e) {
return (e.toLowerCase().indexOf(' ' + srv + ':') !== -1) || (e.toLowerCase().indexOf('/' + srv) !== -1);
return (e.toLowerCase().indexOf(' ' + srv.toLowerCase() + ':') !== -1) || (e.toLowerCase().indexOf('/' + srv.toLowerCase()) !== -1);
});
}
const pids = [];