1
0
Fork 0

Don't show root warning for Podman containers (#11946)

pull/11963/head
maximilian-walter 2024-04-28 17:34:36 +02:00 committed by GitHub
parent 6778f1f79a
commit ea28853305
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -217,7 +217,11 @@ class Application extends BaseApplication
$needsSudoCheck = !Platform::isWindows() $needsSudoCheck = !Platform::isWindows()
&& function_exists('exec') && function_exists('exec')
&& !Platform::getEnv('COMPOSER_ALLOW_SUPERUSER') && !Platform::getEnv('COMPOSER_ALLOW_SUPERUSER')
&& (ini_get('open_basedir') || !file_exists('/.dockerenv')); && (ini_get('open_basedir') || (
!file_exists('/.dockerenv')
&& !file_exists('/run/.containerenv')
&& !file_exists('/var/run/.containerenv')
));
$isNonAllowedRoot = false; $isNonAllowedRoot = false;
// Clobber sudo credentials if COMPOSER_ALLOW_SUPERUSER is not set before loading plugins // Clobber sudo credentials if COMPOSER_ALLOW_SUPERUSER is not set before loading plugins

View File

@ -152,7 +152,9 @@ class Platform
!ini_get('open_basedir') !ini_get('open_basedir')
&& is_readable('/proc/version') && is_readable('/proc/version')
&& false !== stripos((string)Silencer::call('file_get_contents', '/proc/version'), 'microsoft') && false !== stripos((string)Silencer::call('file_get_contents', '/proc/version'), 'microsoft')
&& !file_exists('/.dockerenv') // docker running inside WSL should not be seen as WSL && !file_exists('/.dockerenv') // Docker and Podman running inside WSL should not be seen as WSL
&& !file_exists('/run/.containerenv')
&& !file_exists('/var/run/.containerenv')
) { ) {
return self::$isWindowsSubsystemForLinux = true; return self::$isWindowsSubsystemForLinux = true;
} }