[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Escaping from Lua programs
- From: RLake@...
- Date: Thu, 29 Jan 2004 12:48:49 -0500
> Why, when I run the following:
> lua -e "io.stdin:read '*a'"
> do I need to press Ctrl+C twice to escape?
The first control C is handled by the function below,
which sets a count hook to trigger at the next virtual opcode; this will
call lua_error and generate a backtrace. The sig handler is not reset until
this happens, so the second ctrl+C actually terminates the process.
lua.c line 92
static void laction (int i) {
signal(i, SIG_DFL); /* if another SIGINT happens
before lstop,
terminate process (default
action) */
lua_sethook(L, lstop, LUA_MASKCALL | LUA_MASKRET
| LUA_MASKCOUNT, 1);
}