From 05225dcb984393a2bacfccf0ffc12c39ee74b640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Thu, 16 Mar 2023 12:01:16 +0100 Subject: [PATCH] Support checking `EINTR` constant from `ext-pcntl` without `ext-sockets` --- src/StreamSelectLoop.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/StreamSelectLoop.php b/src/StreamSelectLoop.php index 71983da0..1686fd74 100644 --- a/src/StreamSelectLoop.php +++ b/src/StreamSelectLoop.php @@ -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; }