Skip to content

Commit

Permalink
Fix docker being seen as WSL when run inside WSL, fixes #10094
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Sep 13, 2021
1 parent 4bcd860 commit 6179f33
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Composer/Util/Platform.php
Expand Up @@ -108,7 +108,12 @@ public static function isWindowsSubsystemForLinux()
return self::$isWindowsSubsystemForLinux = false;
}

if (!ini_get('open_basedir') && is_readable('/proc/version') && false !== stripos(Silencer::call('file_get_contents', '/proc/version'), 'microsoft')) {
if (
!ini_get('open_basedir')
&& is_readable('/proc/version')
&& false !== stripos(Silencer::call('file_get_contents', '/proc/version'), 'microsoft')
&& !file_exists('/.dockerenv') // docker running inside WSL should not be seen as WSL
) {
return self::$isWindowsSubsystemForLinux = true;
}
}
Expand Down

0 comments on commit 6179f33

Please sign in to comment.