lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Jun 27, 2006 at 10:36:47AM -0700, Geo Massar wrote:
> If the purpose of the signal function is to catch ctrl-C signals and
> it is only one reason, won't it be good idea to move the signal
> functions inside of the pcall function and add a new status code for
> the user interrupt, say LUA_USERINT, to the other error codes?

How an application handles signals should be under its control.

It looks like the stand-alone lua interpreter causes the interrupt to become a
lua error, which can be caught as it propogates up the stack.

Other applications may prefer to just exit, or have a table of signal-handling
functions that get called, or ...

% lua
Lua 5.1  Copyright (C) 1994-2006 Lua.org, PUC-Rio
> function inf() while true do end end
> inf()
  -- here I do a ctrl-C...
stdin:1: interrupted!
stack traceback:
        stdin:1: in function 'inf'
        stdin:1: in main chunk
        [C]: ?
> = pcall(inf)
  -- here I do a ctrl-C...
false   interrupted!
> 


Does Pascal not give any control over how to handle signals? Does the runtime
always exit, or can you install a function to handle the signal?

Sam