mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
allow compilation with empty target
This commit is contained in:
parent
d8ee308a5f
commit
719bde87b7
@ -86,16 +86,13 @@ class SPCTarget
|
|||||||
*/
|
*/
|
||||||
public static function getTargetOS(): string
|
public static function getTargetOS(): string
|
||||||
{
|
{
|
||||||
$target = getenv('SPC_TARGET');
|
$target = (string) getenv('SPC_TARGET');
|
||||||
if ($target === false) {
|
|
||||||
return PHP_OS_FAMILY;
|
|
||||||
}
|
|
||||||
return match (true) {
|
return match (true) {
|
||||||
str_contains($target, '-linux') => 'Linux',
|
str_contains($target, '-linux') => 'Linux',
|
||||||
str_contains($target, '-macos') => 'Darwin',
|
str_contains($target, '-macos') => 'Darwin',
|
||||||
str_contains($target, '-windows') => 'Windows',
|
str_contains($target, '-windows') => 'Windows',
|
||||||
str_contains($target, '-native') => PHP_OS_FAMILY,
|
str_contains($target, '-native') => PHP_OS_FAMILY,
|
||||||
default => throw new WrongUsageException('Cannot parse target.'),
|
default => PHP_OS_FAMILY,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user