Hi,

While using mod_wombat and attempting to use luasocket (with require
"socket"), I get a white screen. Assuming test.lua is:
-- code --
function handle(r)
  r:write "Start\n"
  require "socket"
  r:write "Done\n"
end
-- end code --
The expected output when requesting this page via a web browser would give:
Start
Done
If "socket" is changed to "lpeg" (assuming you have LPEG installed),
or the require line is commented out, then yes, that is the output.
However, as-is, the response is a blank screen. As far as I can tell,
the cause is this part of luasocket's usocket.c:
/* code */
/*-------------------------------------------------------------------------*\
* Initializes module
\*-------------------------------------------------------------------------*/
int socket_open(void) {
    /* instals a handler to ignore sigpipe or it will crash us */
    signal(SIGPIPE, SIG_IGN);
    return 1;
}
/* end code */
After commenting out the call to signal and recompiling, the above Lua
code will happily load socket.

Why does commenting out this call cause luasocket to now load, and
what undesired consequences are there of doing this?

Peter

Reply via email to