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

Fix scandir on empty directory in UvDriver

This commit is contained in:
Aaron Piotrowski 2018-10-27 11:35:33 -05:00
parent e037235b9b
commit 04f047aec6
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB

View File

@ -453,8 +453,10 @@ class UvDriver implements Driver
$this->poll->listen($deferred->promise());
\uv_fs_readdir($this->loop, $path, 0, function ($fh, $data) use ($deferred, $path) {
if (empty($fh)) {
if (empty($fh) && $data !== 0) {
$deferred->fail(new FilesystemException("Failed reading contents from {$path}"));
} elseif ($data === 0) {
$deferred->resolve([]);
} else {
$deferred->resolve($data);
}