Skip to content

Commit

Permalink
Merge pull request #265 from clue-labs/eintr-pcntl
Browse files Browse the repository at this point in the history
Support checking `EINTR` constant from `ext-pcntl` without `ext-sockets`
  • Loading branch information
WyriHaximus authored Apr 13, 2023
2 parents 747a470 + 05225dc commit 21914ff
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 21914ff

Please sign in to comment.