Separate musl-dist and non-musl-dist

This commit is contained in:
crazywhalecc 2025-03-30 20:20:04 +08:00
parent 631a1b5864
commit 8e5657eff0
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680

View File

@ -203,7 +203,11 @@ class SystemUtil
return null; return null;
} }
if (PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'musl') { if (PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'musl') {
$result = shell()->execWithResult('ldd 2>&1'); if (self::isMuslDist()) {
$result = shell()->execWithResult('ldd 2>&1');
} else {
$result = shell()->execWithResult('/usr/local/musl/lib/libc.so 2>&1');
}
// Match Version * line // Match Version * line
// match ldd version: "Version 1.2.3" match 1.2.3 // match ldd version: "Version 1.2.3" match 1.2.3
$pattern = '/Version\s+(\d+\.\d+\.\d+)/'; $pattern = '/Version\s+(\d+\.\d+\.\d+)/';