BinaryInstaller: install full binaries on WSL when bin-compat=auto (#9855)
parent
4842f213a1
commit
bfea0f7d1e
|
@ -82,7 +82,7 @@ class BinaryInstaller
|
|||
}
|
||||
|
||||
if ($this->binCompat === "auto") {
|
||||
if (Platform::isWindows()) {
|
||||
if (Platform::isWindows() || Platform::isWindowsSubsystemForLinux()) {
|
||||
$this->installFullBinaries($binPath, $link, $bin, $package);
|
||||
} else {
|
||||
$this->installSymlinkBinaries($binPath, $link);
|
||||
|
|
|
@ -21,6 +21,8 @@ class Platform
|
|||
{
|
||||
/** @var ?bool */
|
||||
private static $isVirtualBoxGuest = null;
|
||||
/** @var ?bool */
|
||||
private static $isWindowsSubsystemForLinux = null;
|
||||
|
||||
/**
|
||||
* Parses tildes and environment variables in paths.
|
||||
|
@ -67,6 +69,27 @@ class Platform
|
|||
throw new \RuntimeException('Could not determine user directory');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool Whether the host machine is running on the Windows Subsystem for Linux (WSL)
|
||||
*/
|
||||
public static function isWindowsSubsystemForLinux()
|
||||
{
|
||||
if (null === self::$isWindowsSubsystemForLinux) {
|
||||
self::$isWindowsSubsystemForLinux = false;
|
||||
|
||||
// while WSL will be hosted within windows, WSL itself cannot be windows based itself.
|
||||
if (self::isWindows()) {
|
||||
return self::$isWindowsSubsystemForLinux = false;
|
||||
}
|
||||
|
||||
if (is_readable('/proc/version') && false !== stripos(file_get_contents('/proc/version'), 'microsoft')) {
|
||||
return self::$isWindowsSubsystemForLinux = true;
|
||||
}
|
||||
}
|
||||
|
||||
return self::$isWindowsSubsystemForLinux;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool Whether the host machine is running a Windows OS
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue