Fix docker detection breaking on constrained environments, fixes #12095
parent
4a34725682
commit
1fcb6a5d53
|
@ -197,7 +197,13 @@ class Platform
|
||||||
if (!is_readable($cgroup)) {
|
if (!is_readable($cgroup)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$data = file_get_contents($cgroup);
|
// suppress errors as some environments have these files as readable but system restrictions prevent the read from succeeding
|
||||||
|
// see https://github.com/composer/composer/issues/12095
|
||||||
|
try {
|
||||||
|
$data = @file_get_contents($cgroup);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (is_string($data) && str_contains($data, '/var/lib/docker/')) {
|
if (is_string($data) && str_contains($data, '/var/lib/docker/')) {
|
||||||
return self::$isDocker = true;
|
return self::$isDocker = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue