diff --git a/src/Util/PHP/DefaultPhpProcess.php b/src/Util/PHP/DefaultPhpProcess.php index 16568274c4d..eaa05a6827a 100644 --- a/src/Util/PHP/DefaultPhpProcess.php +++ b/src/Util/PHP/DefaultPhpProcess.php @@ -16,13 +16,10 @@ use function is_array; use function is_resource; use function proc_close; -use function proc_get_status; use function proc_open; -use function rewind; use function stream_get_contents; use function sys_get_temp_dir; use function tempnam; -use function time_nanosleep; use function unlink; use PHPUnit\Framework\Exception; @@ -57,14 +54,6 @@ public function runJob(string $job, array $settings = []): array return $this->runProcess($job, $settings); } - /** - * Returns an array of file handles to be used in place of pipes. - */ - protected function getHandles(): array - { - return []; - } - /** * Handles creating the child process and returning the STDOUT and STDERR. * @@ -75,8 +64,6 @@ protected function getHandles(): array */ protected function runProcess(string $job, array $settings): array { - $handles = $this->getHandles(); - $env = null; if ($this->env) { @@ -92,9 +79,9 @@ protected function runProcess(string $job, array $settings): array } $pipeSpec = [ - 0 => $handles[0] ?? ['pipe', 'r'], - 1 => $handles[1] ?? ['pipe', 'w'], - 2 => $handles[2] ?? ['pipe', 'w'], + 0 => ['pipe', 'r'], + 1 => ['pipe', 'w'], + 2 => ['pipe', 'w'], ]; if ($this->stderrRedirection) { @@ -121,10 +108,6 @@ protected function runProcess(string $job, array $settings): array fclose($pipes[0]); - while (proc_get_status($process)['running'] === true) { - time_nanosleep(0, 100000); - } - $stderr = $stdout = ''; if (isset($pipes[1])) { @@ -139,22 +122,6 @@ protected function runProcess(string $job, array $settings): array fclose($pipes[2]); } - if (isset($handles[1])) { - rewind($handles[1]); - - $stdout = stream_get_contents($handles[1]); - - fclose($handles[1]); - } - - if (isset($handles[2])) { - rewind($handles[2]); - - $stderr = stream_get_contents($handles[2]); - - fclose($handles[2]); - } - proc_close($process); $this->cleanup(); diff --git a/src/Util/PHP/WindowsPhpProcess.php b/src/Util/PHP/WindowsPhpProcess.php index 35ac11aa8b8..75fa9ab909b 100644 --- a/src/Util/PHP/WindowsPhpProcess.php +++ b/src/Util/PHP/WindowsPhpProcess.php @@ -9,9 +9,6 @@ */ namespace PHPUnit\Util\PHP; -use function tmpfile; -use PHPUnit\Framework\Exception; - /** * @internal This class is not covered by the backward compatibility promise for PHPUnit * @@ -19,23 +16,6 @@ */ final class WindowsPhpProcess extends DefaultPhpProcess { - /** - * @throws Exception - * @throws PhpProcessException - */ - protected function getHandles(): array - { - if (false === $stdout_handle = tmpfile()) { - throw new PhpProcessException( - 'A temporary file could not be created; verify that your TEMP environment variable is writable', - ); - } - - return [ - 1 => $stdout_handle, - ]; - } - protected function useTemporaryFile(): bool { return false;