Skip to content

Commit 8d0c032

Browse files
committed
Fix Docker detection
1 parent f61d488 commit 8d0c032

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/Command/FixerApplication.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use PHPStan\Analyser\Error;
1515
use PHPStan\Analyser\IgnoredErrorHelper;
1616
use PHPStan\Analyser\ResultCache\ResultCacheManagerFactory;
17-
use PHPStan\File\CouldNotReadFileException;
1817
use PHPStan\File\FileMonitor;
1918
use PHPStan\File\FileMonitorResult;
2019
use PHPStan\File\FileReader;
@@ -61,7 +60,6 @@
6160
use function React\Promise\resolve;
6261
use function sprintf;
6362
use function strlen;
64-
use function strpos;
6563
use function unlink;
6664
use const PHP_BINARY;
6765
use const PHP_URL_PORT;
@@ -461,17 +459,7 @@ private function reanalyseAfterFileChanges(
461459

462460
private function isDockerRunning(): bool
463461
{
464-
if (!is_file('/proc/1/cgroup')) {
465-
return false;
466-
}
467-
468-
try {
469-
$contents = FileReader::read('/proc/1/cgroup');
470-
471-
return strpos($contents, 'docker') !== false;
472-
} catch (CouldNotReadFileException) {
473-
return false;
474-
}
462+
return is_file('/.dockerenv');
475463
}
476464

477465
}

0 commit comments

Comments
 (0)