Skip to content
This repository was archived by the owner on Oct 1, 2023. It is now read-only.

Commit bc972ff

Browse files
committed
Check for end of file before awaiting
On Linux, awaiting for read on an EOF returns immediately; on Mac, it never returns. This is a regression caused by the recent fix to not specify invalid flags to `stream_await()` - the invalid flags made it /always/ return immediately, hiding this bug. Test Plan: `tests/filesystem/FileTest.php` freezes forever on mac without this change; it passes with it.
1 parent 989c594 commit bc972ff

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/io/_Private/NativeHandle.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ final public function rawReadBlocking(?int $max_bytes = null): string {
5656
if (!$this->isAwaitable) {
5757
return;
5858
}
59+
if ($this->isEndOfFile()) {
60+
return;
61+
}
5962
try {
6063
/* HH_FIXME[2049] *not* PHP stdlib */
6164
/* HH_FIXME[4107] *not* PHP stdlib */

0 commit comments

Comments
 (0)