mirror of
https://github.com/pestphp/pest.git
synced 2026-09-05 14:23:34 +02:00
Prevent memory exhaustion when generating TIA graphs with PCOV (#1875)
* fix(tia): preserve memory limit during pcov restart * chore: update test expectations * fix: stabilize tia replay test in ci
This commit is contained in:
@@ -52,13 +52,8 @@ final class PcovRestarter implements Restarter
|
||||
$env = $this->inheritEnv();
|
||||
$env[self::ENV_RESTARTED] = '1';
|
||||
|
||||
$command = array_merge(
|
||||
[PHP_BINARY, '-d', 'pcov.directory='.$projectRoot],
|
||||
array_values($arguments),
|
||||
);
|
||||
|
||||
$proc = @proc_open(
|
||||
$command,
|
||||
$this->command($projectRoot, $arguments),
|
||||
[STDIN, STDOUT, STDERR],
|
||||
$pipes,
|
||||
null,
|
||||
@@ -74,6 +69,24 @@ final class PcovRestarter implements Restarter
|
||||
exit($exitCode === -1 ? 1 : $exitCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, string> $arguments
|
||||
* @return list<string>
|
||||
*/
|
||||
private function command(string $projectRoot, array $arguments): array
|
||||
{
|
||||
return array_merge(
|
||||
[
|
||||
PHP_BINARY,
|
||||
'-d',
|
||||
'memory_limit='.ini_get('memory_limit'),
|
||||
'-d',
|
||||
'pcov.directory='.$projectRoot,
|
||||
],
|
||||
array_values($arguments),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user