Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ jobs:
- operating-system: 'ubuntu-latest'
php-version: '8.1'
composer-flags: '--ignore-platform-req=php'
phpunit-flags: ''
phpunit-description: ''
- operating-system: 'ubuntu-latest'
php-version: '8.1'
composer-flags: '--ignore-platform-req=php'
phpunit-flags: '-d disable_functions=pcntl_signal_dispatch'
phpunit-description: 'without pcntl'

name: PHP ${{ matrix.php-version }} ${{ matrix.job-description }}

Expand Down Expand Up @@ -65,8 +72,8 @@ jobs:
php -v
composer info -D

- name: Run tests
run: vendor/bin/phpunit ${{ matrix.phpunit-flags }}
- name: Run tests ${{ matrix.phpunit-description }}
run: php ${{ matrix.phpunit-flags }} vendor/bin/phpunit

- name: Run Psalm
run: vendor/bin/psalm.phar --show-info=true
Expand Down
4 changes: 3 additions & 1 deletion src/EventLoop/Driver/StreamSelectDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public function __construct()

$this->signalQueue = new \SplQueue();
$this->timerQueue = new TimerQueue();
$this->signalHandling = \extension_loaded("pcntl");
$this->signalHandling = \extension_loaded("pcntl")
&& \function_exists('pcntl_signal_dispatch')
&& \function_exists('pcntl_signal');

$this->streamSelectErrorHandler = function (int $errno, string $message): void {
// Casing changed in PHP 8 from 'unable' to 'Unable'
Expand Down
12 changes: 12 additions & 0 deletions test/Driver/StreamSelectDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public function testAsyncSignals(): void
self::markTestSkipped('Skip on Windows');
}

if (!\extension_loaded("pcntl")
|| !\function_exists('pcntl_signal_dispatch')
|| !\function_exists('pcntl_signal')) {
self::markTestSkipped('Skip, PCNTL functions not available');
}

\pcntl_async_signals(true);

try {
Expand Down Expand Up @@ -103,6 +109,12 @@ public function testSignalDuringStreamSelectIgnored(): void
self::markTestSkipped('Skip on Windows');
}

if (!\extension_loaded("pcntl")
|| !\function_exists('pcntl_signal_dispatch')
|| !\function_exists('pcntl_signal')) {
self::markTestSkipped('Skip, PCNTL functions not available');
}

$sockets = \stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);

$this->start(function (Driver $loop) use ($sockets, &$signalCallbackId) {
Expand Down