Skip to content

Commit 05225dc

Browse files
committed
Support checking EINTR constant from ext-pcntl without ext-sockets
1 parent 747a470 commit 05225dc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/StreamSelectLoop.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ private function streamSelect(array &$read, array &$write, $timeout)
290290
/** @var ?callable $previous */
291291
$previous = \set_error_handler(function ($errno, $errstr) use (&$previous) {
292292
// suppress warnings that occur when `stream_select()` is interrupted by a signal
293-
$eintr = \defined('SOCKET_EINTR') ? \SOCKET_EINTR : 4;
293+
// PHP defines `EINTR` through `ext-sockets` or `ext-pcntl`, otherwise use common default (Linux & Mac)
294+
$eintr = \defined('SOCKET_EINTR') ? \SOCKET_EINTR : (\defined('PCNTL_EINTR') ? \PCNTL_EINTR : 4);
294295
if ($errno === \E_WARNING && \strpos($errstr, '[' . $eintr .']: ') !== false) {
295296
return;
296297
}

0 commit comments

Comments
 (0)