Skip to content

Commit

Permalink
Support checking EINTR constant from ext-pcntl without ext-sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Apr 13, 2023
1 parent 747a470 commit 05225dc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/StreamSelectLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ private function streamSelect(array &$read, array &$write, $timeout)
/** @var ?callable $previous */
$previous = \set_error_handler(function ($errno, $errstr) use (&$previous) {
// suppress warnings that occur when `stream_select()` is interrupted by a signal
$eintr = \defined('SOCKET_EINTR') ? \SOCKET_EINTR : 4;
// PHP defines `EINTR` through `ext-sockets` or `ext-pcntl`, otherwise use common default (Linux & Mac)
$eintr = \defined('SOCKET_EINTR') ? \SOCKET_EINTR : (\defined('PCNTL_EINTR') ? \PCNTL_EINTR : 4);
if ($errno === \E_WARNING && \strpos($errstr, '[' . $eintr .']: ') !== false) {
return;
}
Expand Down

0 comments on commit 05225dc

Please sign in to comment.