Skip to content
Snippets Groups Projects
Commit 92e130cb authored by Vladislav Shpilevoy's avatar Vladislav Shpilevoy Committed by Konstantin Osipov
Browse files

console: fix a bug in interactive readline usage

Spurious wakeups are possible in console, that makes readline
think that there are some data on stdin. Waked up readline
returns garbage instead of string, that crashes a server on
assertion in Lua.

Closes #3343
parent 6e1ac12e
No related branches found
No related tags found
No related merge requests found
......@@ -221,8 +221,9 @@ lbox_console_readline(struct lua_State *L)
*/
rl_callback_handler_install(prompt, console_push_line);
top = lua_gettop(L);
while (top == lua_gettop(L) &&
coio_wait(STDIN_FILENO, COIO_READ, TIMEOUT_INFINITY)) {
while (top == lua_gettop(L)) {
while (coio_wait(STDIN_FILENO, COIO_READ,
TIMEOUT_INFINITY) == 0);
rl_callback_read_char();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment