1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-11-30 04:19:23 +01:00

Fix #32: Suppress errors for feof, because pthreads

This commit is contained in:
Niklas Keller 2017-12-10 17:36:05 +01:00
parent cd4ef8553e
commit c5e31aa7b7

View File

@ -57,7 +57,10 @@ final class ResourceInputStream implements InputStream {
}
\assert($data !== false, "Trying to read from a previously fclose()'d resource. Do NOT manually fclose() resources the loop still has a reference to.");
if ($data === '' && \feof($stream)) {
// error suppression, because pthreads does crazy things with resources, which might be closed during two operations
// see https://github.com/amphp/byte-stream/issues/32
if ($data === '' && @\feof($stream)) {
$readable = false;
Loop::cancel($watcher);
$data = null; // Stream closed, resolve read with null.