currentLoad() improved parsing (linux)
This commit is contained in:
+1
-1
@@ -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
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user