Skip to content

Commit 0e32301

Browse files
committed
Try fixing CpuCoreCounter problem
1 parent e1dd35c commit 0e32301

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Process/CpuCoreCounter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function getNumberOfCpuCores(): int
1515

1616
// from brianium/paratest
1717
$cores = 2;
18-
if (is_file('/proc/cpuinfo')) {
18+
if (@is_file('/proc/cpuinfo')) {
1919
// Linux (and potentially Windows with linux sub systems)
2020
$cpuinfo = @file_get_contents('/proc/cpuinfo');
2121
if ($cpuinfo !== false) {
@@ -27,7 +27,7 @@ public function getNumberOfCpuCores(): int
2727
if (\DIRECTORY_SEPARATOR === '\\') {
2828
// Windows
2929
$process = @popen('wmic cpu get NumberOfLogicalProcessors', 'rb');
30-
if ($process !== false) {
30+
if (is_resource($process)) {
3131
fgets($process);
3232
$cores = (int) fgets($process);
3333
pclose($process);
@@ -37,7 +37,7 @@ public function getNumberOfCpuCores(): int
3737
}
3838

3939
$process = @\popen('sysctl -n hw.ncpu', 'rb');
40-
if ($process !== false) {
40+
if (is_resource($process)) {
4141
// *nix (Linux, BSD and Mac)
4242
$cores = (int) fgets($process);
4343
pclose($process);

0 commit comments

Comments
 (0)