Skip to content

Commit

Permalink
Make PHP 8 green on Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed May 23, 2020
1 parent f5104c9 commit 8a895f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Pipes/UnixPipes.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function readAndWrite($blocking, $close = false)
$read[$type = array_search($pipe, $this->pipes, true)] = '';

do {
$data = fread($pipe, self::CHUNK_SIZE);
$data = @fread($pipe, self::CHUNK_SIZE);
$read[$type] .= $data;
} while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));

Expand Down
9 changes: 8 additions & 1 deletion Tests/ProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -987,16 +987,23 @@ public function provideMethodsThatNeedATerminatedProcess()
*/
public function testWrongSignal($signal)
{
$this->expectException('Symfony\Component\Process\Exception\RuntimeException');
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('POSIX signals do not work on Windows');
}

if (\PHP_VERSION_ID < 80000 || \is_int($signal)) {
$this->expectException(RuntimeException::class);
} else {
$this->expectException('TypeError');
}

$process = $this->getProcessForCode('sleep(38);');
$process->start();
try {
$process->signal($signal);
$this->fail('A RuntimeException must have been thrown');
} catch (\TypeError $e) {
$process->stop(0);
} catch (RuntimeException $e) {
$process->stop(0);
}
Expand Down

0 comments on commit 8a895f0

Please sign in to comment.