1
0
mirror of https://github.com/danog/file.git synced 2024-11-26 11:54:54 +01:00

Ensure reads resolve to null on EOF, fixes #13

This commit is contained in:
Niklas Keller 2017-06-20 18:25:37 +02:00
parent dd64670987
commit 4cccc8d0f7
2 changed files with 2 additions and 1 deletions

View File

@ -66,7 +66,7 @@ class EioHandle implements Handle {
));
} else {
$this->position += \strlen($result);
$deferred->resolve($result);
$deferred->resolve(\strlen($result) ? $result : null);
}
}

View File

@ -53,6 +53,7 @@ abstract class HandleTest extends TestCase {
$this->assertSame($position, $handle->tell());
}
$this->assertNull(yield $handle->read());
$this->assertSame(yield File\get(__FILE__), $contents);
yield $handle->close();