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

Commit

Permalink
Don't include STREAM_AWAIT_ERROR in stream_await call
Browse files Browse the repository at this point in the history
Summary:
STREAM_AWAIT_ERROR is a return code, not an event type.

This is fine on some Linux systems, but on others and MacOS it returns instantly, leading to busy loops.

This API isn't as typed as we'd like as it's older than enums. Being replaced
with HSL IO.

Reviewed By: alexeyt

Differential Revision: D14142241

fbshipit-source-id: d5f9be7b5e68893fde113473c6a5d9adf2394abf
  • Loading branch information
fredemmott committed Feb 20, 2019
1 parent a652d50 commit c1084e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/io/_Private/NativeHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ final public function rawReadBlocking(?int $max_bytes = null): string {
$max_bytes -= Str\length($chunk);
}
if ($max_bytes === null || $max_bytes > 0) {
await $this->selectAsync(\STREAM_AWAIT_READ | \STREAM_AWAIT_ERROR);
await $this->selectAsync(\STREAM_AWAIT_READ);
}
}
return $data;
Expand Down Expand Up @@ -111,7 +111,7 @@ final public function rawReadBlocking(?int $max_bytes = null): string {
}
$data = $impl();
while ($data === false && !$this->isEndOfFile()) {
await $this->selectAsync(\STREAM_AWAIT_READ | \STREAM_AWAIT_ERROR);
await $this->selectAsync(\STREAM_AWAIT_READ);
$data = $impl();
}
return $data === false ? '' : $data;
Expand All @@ -136,7 +136,7 @@ final public function writeAsync(string $bytes): Awaitable<void> {
if ($bytes === '') {
break;
}
await $this->selectAsync(\STREAM_AWAIT_WRITE | \STREAM_AWAIT_ERROR);
await $this->selectAsync(\STREAM_AWAIT_WRITE);
}
});
}
Expand Down

0 comments on commit c1084e5

Please sign in to comment.