Let ctrl-c interrupt lua server pages in repl mode

This commit is contained in:
Justine Tunney 2022-05-14 11:47:16 -07:00
parent 178a6da4b9
commit 54e6f564c1
3 changed files with 32 additions and 3 deletions

View file

@ -380,6 +380,13 @@ int lua_loadline (lua_State *L) {
}
void lua_sigint (lua_State *L, int sig) {
int flag = LUA_MASKCALL | LUA_MASKRET | LUA_MASKLINE | LUA_MASKCOUNT;
lua_sethook(L, lstop, flag, 1);
}
/*
** Function to be called at a C signal. Because a C signal cannot
** just change a Lua state (as there is no proper synchronization),
@ -387,6 +394,7 @@ int lua_loadline (lua_State *L) {
** interpreter.
*/
static void laction (int i) {
lua_sigint(globalL, i);
int flag = LUA_MASKCALL | LUA_MASKRET | LUA_MASKLINE | LUA_MASKCOUNT;
lua_sethook(globalL, lstop, flag, 1);
}