Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions fs/src/fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ int listdir(lua_State* L)

uv_dirent_t dir;
int i = 0;
while (uv_fs_scandir_next(req, &dir) != UV_EOF)
int err = 0;
while ((err = uv_fs_scandir_next(req, &dir)) >= 0)
{
lua_pushinteger(L, ++i);

Expand All @@ -418,9 +419,12 @@ int listdir(lua_State* L)

lua_settable(L, -3);
}

delete req;

if (err != UV_EOF)
luaL_errorL(L, "%s", uv_strerror(err));

return 1;
}
);
Expand Down