Skip to content

Commit bdc5ae8

Browse files
mvorisekondrejmirtes
authored andcommitted
Use 1 CPU only when "proc_open" function is disabled
1 parent 00ff86b commit bdc5ae8

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/Process/CpuCoreCounter.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ public function getNumberOfCpuCores(): int
1313
return $this->count;
1414
}
1515

16+
if (!function_exists('proc_open')) {
17+
return $this->count = 1;
18+
}
19+
1620
// from brianium/paratest
17-
$cores = 2;
1821
if (@is_file('/proc/cpuinfo')) {
1922
// Linux (and potentially Windows with linux sub systems)
2023
$cpuinfo = @file_get_contents('/proc/cpuinfo');
@@ -43,7 +46,7 @@ public function getNumberOfCpuCores(): int
4346
pclose($process);
4447
}
4548

46-
return $this->count = $cores;
49+
return $this->count = 2;
4750
}
4851

4952
}

0 commit comments

Comments
 (0)