8000 Fix error handling for scandir call by bjcscat · Pull Request #103 · luau-lang/lute · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix error handling for scandir call #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 14, 2025
Merged
Changes from all commits
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
7 changes: 5 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,11 @@ 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
0