Skip to content

Commit

Permalink
Succeed reads with null on closed stream
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed May 12, 2017
1 parent c2eac67 commit f6e765c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ResourceInputStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Amp\Failure;
use Amp\Loop;
use Amp\Promise;
use Amp\Success;

class ResourceInputStream implements InputStream {
const DEFAULT_CHUNK_SIZE = 8192;
Expand Down Expand Up @@ -87,7 +88,7 @@ public function read(): Promise {
}

if (!$this->readable) {
return new Failure(new ClosedException("The stream has been closed"));
return new Success; // Resolve with null on closed stream.
}

$this->deferred = new Deferred;
Expand Down

0 comments on commit f6e765c

Please sign in to comment.