Skip to content

Commit

Permalink
Fix Docker detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 2, 2023
1 parent f61d488 commit 8d0c032
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/Command/FixerApplication.php
Expand Up @@ -14,7 +14,6 @@
use PHPStan\Analyser\Error;
use PHPStan\Analyser\IgnoredErrorHelper;
use PHPStan\Analyser\ResultCache\ResultCacheManagerFactory;
use PHPStan\File\CouldNotReadFileException;
use PHPStan\File\FileMonitor;
use PHPStan\File\FileMonitorResult;
use PHPStan\File\FileReader;
Expand Down Expand Up @@ -61,7 +60,6 @@
use function React\Promise\resolve;
use function sprintf;
use function strlen;
use function strpos;
use function unlink;
use const PHP_BINARY;
use const PHP_URL_PORT;
Expand Down Expand Up @@ -461,17 +459,7 @@ private function reanalyseAfterFileChanges(

private function isDockerRunning(): bool
{
if (!is_file('/proc/1/cgroup')) {
return false;
}

try {
$contents = FileReader::read('/proc/1/cgroup');

return strpos($contents, 'docker') !== false;
} catch (CouldNotReadFileException) {
return false;
}
return is_file('/.dockerenv');
}

}

0 comments on commit 8d0c032

Please sign in to comment.