mirror of
https://github.com/danog/psalm.git
synced 2024-12-13 01:37:23 +01:00
fixed Uncaught Error: Call to undefined function shell_exec()
This commit is contained in:
parent
b4f4c94f77
commit
449ef0d994
@ -1449,9 +1449,20 @@ class ProjectAnalyzer
|
||||
return 1;
|
||||
}
|
||||
|
||||
$has_nproc = trim((string) @shell_exec('command -v nproc'));
|
||||
if ($has_nproc) {
|
||||
$ret = @shell_exec('nproc');
|
||||
if (\function_exists('shell_exec')) {
|
||||
$has_nproc = trim((string) @shell_exec('command -v nproc'));
|
||||
if ($has_nproc) {
|
||||
$ret = @shell_exec('nproc');
|
||||
if (is_string($ret)) {
|
||||
$ret = trim($ret);
|
||||
$tmp = filter_var($ret, FILTER_VALIDATE_INT);
|
||||
if (is_int($tmp)) {
|
||||
return $tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ret = @shell_exec('sysctl -n hw.ncpu');
|
||||
if (is_string($ret)) {
|
||||
$ret = trim($ret);
|
||||
$tmp = filter_var($ret, FILTER_VALIDATE_INT);
|
||||
@ -1461,15 +1472,6 @@ class ProjectAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
$ret = @shell_exec('sysctl -n hw.ncpu');
|
||||
if (is_string($ret)) {
|
||||
$ret = trim($ret);
|
||||
$tmp = filter_var($ret, FILTER_VALIDATE_INT);
|
||||
if (is_int($tmp)) {
|
||||
return $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_readable('/proc/cpuinfo')) {
|
||||
$cpuinfo = file_get_contents('/proc/cpuinfo');
|
||||
$count = substr_count($cpuinfo, 'processor');
|
||||
|
Loading…
Reference in New Issue
Block a user