# HG changeset patch # User daurnimator # Date 1414008040 14400 # Node ID 4224abbf0fddc8d469ab842c43766064f2a2c3be # Parent 913585bca01f6543cac2519a97a827e629f2bea6 net/server: Handle lack of util.signal correctly diff -r 913585bca01f -r 4224abbf0fdd net/server.lua --- a/net/server.lua Wed Oct 22 15:59:51 2014 -0400 +++ b/net/server.lua Wed Oct 22 16:00:40 2014 -0400 @@ -66,9 +66,9 @@ end -- If server.hook_signal exists, replace signal.signal() -local ok, signal = pcall(require, "util.signal"); -if server.hook_signal then - if ok then +local has_signal, signal = pcall(require, "util.signal"); +if has_signal then + if server.hook_signal then function signal.signal(signal_id, handler) if type(signal_id) == "string" then signal_id = signal[signal_id:upper()]; @@ -78,9 +78,15 @@ end return server.hook_signal(signal_id, handler); end + else + server.hook_signal = signal.signal; end else - server.hook_signal = signal.signal; + if not server.hook_signal then + server.hook_signal = function() + return false, "signal hooking not supported" + end + end end if prosody then