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 ($this->binCompat === "auto") {
|
||||||
if (Platform::isWindows()) {
|
if (Platform::isWindows() || Platform::isWindowsSubsystemForLinux()) {
|
||||||
$this->installFullBinaries($binPath, $link, $bin, $package);
|
$this->installFullBinaries($binPath, $link, $bin, $package);
|
||||||
} else {
|
} else {
|
||||||
$this->installSymlinkBinaries($binPath, $link);
|
$this->installSymlinkBinaries($binPath, $link);
|
||||||
|
|
|
@ -21,6 +21,8 @@ class Platform
|
||||||
{
|
{
|
||||||
/** @var ?bool */
|
/** @var ?bool */
|
||||||
private static $isVirtualBoxGuest = null;
|
private static $isVirtualBoxGuest = null;
|
||||||
|
/** @var ?bool */
|
||||||
|
private static $isWindowsSubsystemForLinux = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses tildes and environment variables in paths.
|
* Parses tildes and environment variables in paths.
|
||||||
|
@ -67,6 +69,27 @@ class Platform
|
||||||
throw new \RuntimeException('Could not determine user directory');
|
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
|
* @return bool Whether the host machine is running a Windows OS
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue