mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-05-01 01:27:22 +08:00
improve pcntl function check
This commit is contained in:
@@ -97,9 +97,8 @@ class Test extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$r = executeCommand("php -m");
|
$r = executeCommand("php -r 'var_export(function_exists(\"pcntl_alarm\"));'");
|
||||||
$r = preg_split("/[\r\n]+/", $r);
|
dd($r == 'true');
|
||||||
dd($r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Install
|
|||||||
];
|
];
|
||||||
protected array $requiredFunctions = [
|
protected array $requiredFunctions = [
|
||||||
'symlink', 'putenv', 'proc_open', 'proc_get_status', 'exec',
|
'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';
|
protected string $lockFile = 'install.lock';
|
||||||
@@ -168,7 +168,13 @@ class Install
|
|||||||
|
|
||||||
$disabledFunctions = [];
|
$disabledFunctions = [];
|
||||||
foreach ($this->requiredFunctions as $fn) {
|
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;
|
$disabledFunctions[] = $fn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user