diff --git a/src/core/Helper/OSHelper.php b/src/core/Helper/OSHelper.php index 7c08e2854..480e7b6f7 100644 --- a/src/core/Helper/OSHelper.php +++ b/src/core/Helper/OSHelper.php @@ -33,10 +33,9 @@ public static function getCpu(): ?Cpu { return null; } - $grep = "%Cpu(s):"; - exec("top -b -n 1 |grep '$grep'", $output); + exec("top -b -n 1 |grep '%Cpu(s):'", $output); - preg_match_all("/[0-9.]+/", $output[0], $values); + preg_match_all("/[\d.]+/", $output[0], $values); $cpu = new Cpu(); $cpu->setUs(floatval(trim($values[0][0])));