From 7ca8f6f78156e1681bfd18552bb77c27ef44b6a1 Mon Sep 17 00:00:00 2001 From: Tim Harley Date: Fri, 10 Oct 2014 16:02:34 +0100 Subject: [PATCH] Catch signals while printing the results of expressions. --- src/luajit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/luajit.c b/src/luajit.c index d1326e2..f6d7f95 100644 --- a/src/luajit.c +++ b/src/luajit.c @@ -262,10 +262,16 @@ static void dotty(lua_State *L) if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */ lua_getglobal(L, "print"); lua_insert(L, 1); +#if !LJ_TARGET_CONSOLE + signal(SIGINT, laction); +#endif if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) l_message(progname, lua_pushfstring(L, "error calling " LUA_QL("print") " (%s)", lua_tostring(L, -1))); +#if !LJ_TARGET_CONSOLE + signal(SIGINT, SIG_DFL); +#endif } } lua_settop(L, 0); /* clear stack */