mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
improve pcntl function check
This commit is contained in:
@@ -97,9 +97,8 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$r = executeCommand("php -m");
|
||||
$r = preg_split("/[\r\n]+/", $r);
|
||||
dd($r);
|
||||
$r = executeCommand("php -r 'var_export(function_exists(\"pcntl_alarm\"));'");
|
||||
dd($r == 'true');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class Install
|
||||
];
|
||||
protected array $requiredFunctions = [
|
||||
'symlink', 'putenv', 'proc_open', 'proc_get_status', 'exec',
|
||||
// 'pcntl_signal', 'pcntl_alarm', 'pcntl_async_signals'
|
||||
'pcntl_signal', 'pcntl_alarm', 'pcntl_async_signals'
|
||||
];
|
||||
|
||||
protected string $lockFile = 'install.lock';
|
||||
@@ -168,7 +168,13 @@ class Install
|
||||
|
||||
$disabledFunctions = [];
|
||||
foreach ($this->requiredFunctions as $fn) {
|
||||
if (!function_exists($fn)) {
|
||||
if (str_starts_with($fn, "pcntl_")) {
|
||||
$phpPath = nexus_env('PHP_PATH') ?: 'php';
|
||||
$exists = executeCommand("$phpPath -r 'var_export(function_exists(\"$fn\"));'") == 'true';
|
||||
if (!$exists) {
|
||||
$disabledFunctions[] = $fn;
|
||||
}
|
||||
} elseif (!function_exists($fn)) {
|
||||
$disabledFunctions[] = $fn;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user