Software /
code /
prosody-modules
Changeset
5875:dde9d21a599f
mod_traceback: Hook signal via event instead of directly
Safer this way, see Prosody trunk rev 69faf3552d52
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 02 Mar 2024 14:47:09 +0100 |
parents | 5874:0358fcf14cd6 |
children | 5876:133b23758cf6 |
files | mod_traceback/mod_traceback.lua |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_traceback/mod_traceback.lua Sat Mar 02 14:42:27 2024 +0100 +++ b/mod_traceback/mod_traceback.lua Sat Mar 02 14:47:09 2024 +0100 @@ -2,9 +2,10 @@ local traceback = require "util.debug".traceback; -require"util.signal".signal(module:get_option_string(module.name, "SIGUSR1"), function () - module:log("info", "Received SIGUSR1, writing traceback"); - local f = io.open(prosody.paths.data.."/traceback.txt", "a+"); +local signal = module:get_option_string(module.name, "SIGUSR1"); +module:hook("signal/" .. signal, function() + module:log("info", "Received %s, writing traceback", signal); + local f = io.open(prosody.paths.data .. "/traceback.txt", "a+"); f:write(traceback(), "\n"); f:close(); end);