Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Platform.php

function Platform::isWindowsSubsystemForLinux

Return value

bool Whether the host machine is running on the Windows Subsystem for Linux (WSL)

1 call to Platform::isWindowsSubsystemForLinux()
BinaryInstaller::installBinaries in vendor/composer/composer/src/Composer/Installer/BinaryInstaller.php

File

vendor/composer/composer/src/Composer/Util/Platform.php, line 157

Class

Platform
Platform helper for uniform platform-specific tests.

Namespace

Composer\Util

Code

public static function isWindowsSubsystemForLinux() : bool {
    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 (!(bool) ini_get('open_basedir') && is_readable('/proc/version') && false !== stripos((string) Silencer::call('file_get_contents', '/proc/version'), 'microsoft') && !self::isDocker()) {
            return self::$isWindowsSubsystemForLinux = true;
        }
    }
    return self::$isWindowsSubsystemForLinux;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal